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. Out of memory exceptions and difference between emulator and hardware (dev phone)

Hi,
   I have read a couple of threads about Bitmap creation and release
using "recycle()" but still have a problem with an OOM when running my
app (that creates bitmaps) on hardware - the dev phone 1 in this case.
Multiple passes through my application screens work fine in the
emulator but performing the same actions on the device results in an
OOM exception almost immediately.
   At this point I would really like a deterministic way to replicate
the scenario on the emulator which I thought should be possible by
limiting its memory (though I did read somewhere that the emulator and
the dev phone 1 have the same default memory so this should be moot
but whatever) i.e. -memory 64, but I am having zero success.
   Am I using the correct emulator args to limit the memory and/or
what is the strategy for making the emulator exactly the same as the
device at least with respect to memory constraints/pressure?

thnx,
L.

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

2. Porting RDP (Remote Desktop Protocol) to Android -- questions

Is there any java rdp client ?  I suppose you can develop based on this?

2009/6/23 kirkbeaty <kirkbe...@gmail.com>


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

3. Problem with dialog title and dialog background

4. Re : Re : How to catch BOOT_COMPLETED_ACTION from an IntentReceiver

5. Application Needed

6. how to avoid the showing of prev,next buttons of MediaController

7. Ubiquitous Social Networks