简体   繁体   中英

how to finish two or more activites created by parent activity in android

i am creating an app in which Activity A creates Activity B and Activity A goes to Background and activity B in Foreground..

when back is pressed in activity B then Activity A comes to foreground and Activity B to background.. Now Activity A creates Activity C again Activity A in background and Activity C in foreground.. Ie now C is foreground and activity A,B are in Background

when back is pressed in activity C then Activity A comes to foreground and Activity C to background..

Ie now A is foreground and activity C,B are in Background

now if Back is pressed in Activity A den i should finish All activities ie A,B,C and should close the app...

how to implement this can any one help me out..

This is the default behavior of Android. You don't have to do anything special for this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM