Re: [android-developers] how to finish all activities running in foreground or background(has been paused)?
On Sun, Jun 26, 2011 at 6:24 AM, Hitendrasinh Gohil
<hitendra.virtueinfo@gmail.com> wrote:
> I need to do something like i.e when user clicks on quit button all
> activities should be finish and homescreen should come.
The user can press the HOME button for that. Android applications do
not need a "quit" button.
http://blog.radioactiveyak.com/2010/05/when-to-include-exit-button-in-android.html
Now, if by "homescreen" you mean the main activity of your
application, simply add
FLAG_ACTIVITY_CLEAR_TOP|FLAG_ACTIVITY_SINGLE_TOP to the Intent you
would use to ordinarily start that activity. The resulting
startActivity() call will bring your main activity to the foreground
and remove other activities in your back stack.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android 3.1 Programming Books: http://commonsware.com/books
--
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home