Android back button problem -
Android back button problem -
say have 3 activities in application: a, b , c. flow though application is: -> b -> c.
once @ c, pressing button take user b. if user presses button time got a, , if press 1 more time, exit application.
objective: when user presses button on c, should go , not b, , if press time, exit app.
problem: when overriding button on activity c launch activity appears ok. if user presses button again, homecoming activity c. , pressing button switches between activity , activity c.
i guess activity stack looks like:
open app: a go b: a, b go c: a, b, c press back: a, b, c, a press back: a, b, c press back: a, b, c, a press back: a, b, c press back: a, b, c, a press back: a, b, c press back: a, b, c, a ...etcso seems error launch new activity when button on c pressed? anyway, advice on how implement behaviour.
thanks, jack
you can add together finish()
in onstop()
method of activity b.
this way, when activity b no longer visible, destroyed , removed stack.
open app: a go b: a, b go c: a, c press back: a press back: exiting android button back
Comments
Post a Comment