Sunday, February 27, 2011

Re: [android-developers] Launching an app from the quick search box creates a new instance of the app?

singleTask is for specific types of flow through activities; it is not a work-around for this kind of situation.

As someone else said, your first step should be to actually *look* at the crash that is happening in your fourth scenario and fix it.

You also haven't really given a clear idea of what you mean by it "creating a new instance of your app".  Does your app consist of only one activity?  So you are actually creating a new instance of your activity?  If so, then yes, this is expected, because the activity is being launched with different arguments (the ones from the search) so it needs to run to show that data.  You do need to make sure you can handle this (fix your crash).  To avoid the new instance being created, you can use the "singleTop" launch mode (please read the docs on it to understand it).

On Sun, Feb 27, 2011 at 8:56 PM, ZEAN QIN <qinzean@gmail.com> wrote:
Hi, sureshmenon87:

Thanks a lot. It works for me. 

But it seems to introduce another problem: After I launched the "singleTask" activity to the task and go to some other activities from there, I click the "HOME" button to send the current task to the background. Then when I click the icon for this app, it only brings back the "singleTask" activity and retains all its state, but all the other activities are lost.

Is there a way to fix this? 

Thanks a lot

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
Dianne Hackborn
Android framework engineer
hackbod@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.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment