1

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:)

Remmyabhavan
  • 1,689
  • 5
  • 36
  • 65

4 Answers4

4

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.

neteinstein
  • 17,529
  • 11
  • 93
  • 123
DeRagan
  • 22,827
  • 6
  • 41
  • 50
2

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.

Aliaksei Kliuchnikau
  • 13,589
  • 4
  • 59
  • 72
Ankit Dhingra
  • 125
  • 1
  • 5
1

Try to kill your process, like:

android.os.Process.killProcess(android.os.Process.myPid());
Barmaley
  • 16,638
  • 18
  • 73
  • 146
1

May be you should consider another way of resolving the problem. Try not to exit the application but somehow override the onResume() method.

Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103