0

My main activity is set to use the singleTask model, and activity2 will be started through main activity, if I press the Home button at the activity, and then enter my application again I will go in to the main activity rather than the latest activity activity2.

And I have googled ,and found a same problem in this post and it have got a solution.

However when I use google map, I found that it does not use any solution mentioned in the post.

The MapActivity of Google Map is singleTask with a MAIN intent-filter.

But if you see this, you will find that use will get back to the latest activity.

What solution may google map use?

Community
  • 1
  • 1
hguser
  • 35,079
  • 54
  • 159
  • 293
  • Nothing happen when I click back button(But the `up` icon will be invisible), still at the `mainActivity`, and I will exit if I click back again. – hguser Oct 30 '13 at 04:30
  • When you press home button and again launch app you enter `MainActivity`. Now if you press back button what happens. – Raghunandan Oct 30 '13 at 04:34
  • check this http://developer.android.com/guide/components/tasks-and-back-stack.html might help – Raghunandan Oct 30 '13 at 04:35
  • @Raghunandan: http://imgbin.org/images/15518.gif This is my app workflow. – hguser Oct 30 '13 at 04:56
  • override the activity life cycle methods and log some info there for each of the activities. Check the log. your activities are destroyed and so it launches MainActivity – Raghunandan Oct 30 '13 at 06:31
  • Destroyed? Why, does return HOME will cause the app to be destroyed? If so , any idea to avoid it? BTW, from the post I mentioned http://stackoverflow.com/questions/2417468/android-bug-in-launchmode-singletask-activity-stack-not-preserved/3002890#comment29217180_3002890, it seems that this is caused by the `singleTask` . – hguser Oct 30 '13 at 06:36
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/40234/discussion-between-raghunandan-and-hguser) – Raghunandan Oct 30 '13 at 06:44
  • use singleTop instead of singletask an try – Raghunandan Oct 30 '13 at 07:24
  • OK, I will have a try. – hguser Oct 30 '13 at 07:26

0 Answers0