How to clear the Android Stack of activities? -


i have application several activities in android , want user able log-out pressing menu button. problem have that

a) android doesn't let terminate application and
b) when send user loginactivity again can press back , right previous activity in.

i tried launch activity 2 following flags:

intent intent  = new intent(this, loginactivity.class); intent.setflags(intent.flag_activity_new_task); intent.setflags(intent.flag_activity_clear_top);         startactivity(intent); 

i tried each 1 of them themselves.

i tried calling finish() after startactivity(intent) read in stackoverflow question.

in login activity, override button, hides app instead of finishing activity:

@override public boolean onkeydown(int keycode, keyevent event) {     if (keycode == keyevent.keycode_back) {         movetasktoback(true);         return true;     }     return super.onkeydown(keycode, event); } 

also sure set android:alwaysretaintaskstate="true" on root activity, android doesn't clear stack (including login activity) after 30min of inactivity user.

then call finish() when there successful login.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -