I have an application which works when the user logs in. However, whenever there is a request to server and the reply contains session_expired, I need to clear the activity stack and show user just the login screen. This should be trivial however I am not able to find out a proper way to approach this without littering finish() inside every activity with conditional code. How can I just clear the activity stack and push just one activity? My application requires android 2.2 and up. I understand that it was introduced a new intent flag in honeycomb in order to just do that, but I need to support it for froyo and gingerbread also.
Asked
Active
Viewed 1,251 times
5
-
possible duplicate of http://stackoverflow.com/questions/6826757/android-how-to-logout-from-the-application however I know that approach and it is messy. – Vaibhav Mishra Nov 17 '11 at 12:03
1 Answers
3
You can use FLAG_ACTIVITY_CLEAR_TOP
http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP

kikoso
- 673
- 1
- 6
- 17
-
1although this does not solve my problem because of the way I structured my app but if I knew about it while creating app then it would definitely helped me, in future app this would work, however thename of flag is misleading. – Vaibhav Mishra Nov 19 '11 at 17:38