More Than One Instance of Application

by Noam » Fri, 10 Apr 2009 05:39:38 GMT


Sponsored Links
 Hello,
Is there a way to prevent the user of opening more than one instance
of my application?

For example:
User clicks on App and opens it.
The user clicks on the home button. (the app is still running in the
background)
The user clicks on (not the menu button, but the button above it in
the homescreen), and then opens the application again.
Does it open the same instance, or does it create another one?
If it does create another one, how can I prevent it from creating
another one, and just opening the existing instance?

Thanks,
Noam.
--~--~---------~--~----~------------~-------~--~----~



More Than One Instance of Application

by Dianne Hackborn » Fri, 10 Apr 2009 06:29:56 GMT


 It brings the currently running instance to the foreground.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


More Than One Instance of Application

by Jason Van Anden » Fri, 10 Apr 2009 21:02:36 GMT


 I ran into this as well. Try adding this to the Activity tag ...

android:launchMode="singleTask"

Jason Van Anden
 http://www.smileproject.com 






--~--~---------~--~----~------------~-------~--~----~



More Than One Instance of Application

by Roman Baumgaertner » Mon, 13 Apr 2009 12:04:16 GMT


 Noam,

Try to use the singleton pattern in your application. If you have already an
instance created and try to create another one, then you would not be able
to do this.


Sr. SW Engineer
Roman Baumgaertner

T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.









--~--~---------~--~----~------------~-------~--~----~



More Than One Instance of Application

by Roman » Mon, 13 Apr 2009 12:04:17 GMT


 Noam,

Try to use the singleton pattern in your application. If you have
already an instance created and try to create another one, then you
would not be able to do this because of the singleton pattern.


Sr. SW Engineer
Roman Baumgaertner

T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.




--~--~---------~--~----~------------~-------~--~----~



More Than One Instance of Application

by Streets Of Boston » Mon, 13 Apr 2009 22:32:56 GMT


 This won't work.

Android controls the creation of activities. Android provides
callbacks such as 'onCreate' (and 'onDestroy', etc.) that inform the
application developer of the lifetime management of his/her activity.

In anser to the original question from Noam:
go to  http://developer.android.com/guide/topics/fundamentals.html and 
read up on the "Launch Modes" section. You'll get the info you need
from there.




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Any cheap solutions of GPS signal simulation?





You mean besides "go outside" ?

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 

2. Android visualization Algorithm

hi guys,

i would like to develop a visualization Algorithm which is like Nexus
Boot animation.
how do i develop an algorithm like that??

regards,
HR

-- 

3. hTC Desire getting official Android 2 . 2 rollout tomorrow

4. Media Recorder Error codes

5. hTC Desire getting official Android 2 . 2 rollout tomorro

6. Fwd: Slider Drawer Problem - disappearing slider

7. How to access build type [release/debug] in java/xml code at run time