简体   繁体   中英

Resuming Activity Android

I have 4 activities, ABCDA is Menu and it's contained from 3 buttons that start other 3 activities, BC D. What I want, I want when I start BCD activity and decide to go to menu, to show Menu. It's working but there is a problem. Always when I go back to Menu, there is a Copy of Menu Activity. So how can I set it to resume activity not create new one? But Without destroying it.

Without any code, its a little unclear what your problem is but I think what you want is to set an Intent.Flag . When starting the Activity add this flag to your Intent

Intent i = new Intent(CurrentActivityName.this, MenuActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);  // set the flag
startActivity(i);[

and don't call finish() in your menu Activity .

Intent Docs

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