Exit application completely in android
Hello In my android application,on exit of application by using movetasktoback开发者_运维技巧(true) on back of Homescreen,if the user reloads the application again ,the user is redirected directly to Homepage other that to loading screen. Is there any solution that i could exit the application on Home and wherein should clear all the stack created in this app.
Please share your valuable suggestions.
Thanks in advance:)
There are lot of discussions that has happened with respect to this topic. Killing the process is certainly not the best way to go.
You can try setting android:finishOnTaskLaunch
as true to your root activity or try using android:clearTaskOnLaunch
http://developer.android.com/guide/topics/manifest/activity-element.html#finish
You also need to add on main activity
android:launchMode="singleTask"
Or it might not work properly.
if u want to start your application from your main page after quitting from application.
set FLAG_ACTIVITY_CLEAR_TOP
at quitting button or whatever you have used.
You must use android.os.Process.killProcess(android.os.Process.myPid());
but it must be used on your main activity then it will close the application completely.
Try to kill your process, like:
android.os.Process.killProcess(android.os.Process.myPid());
May be you should consider another way of resolving the problem. Try not to exit the application but somehow override the onResume() method.
精彩评论