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.
You can use FLAG_ACTIVITY_CLEAR_TOP
http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With