简体   繁体   中英

ANDROID - Activity does not destroy the main Activity

I have a main Activity takes a while to load, as it reads the customer base and load screen. When I call another Activity (which shows outstanding customer receipts), to give the "back" button I load the main Activity instantly. However when I call the other Activitys (Orders, History, etc. ..), to give the "back" button takes a while to show again Customers. It's like one of the Activity does not destroy the main Activity, and the rest if you destroy it. All are created in the same way (I think). Can this happen? What to call an Activity is not destroyed the main? Can be a memory issue?

Under normal circumstances, when going from one Activity to the other, the first Activity is not destroyed. It's pushed on to a backstack so that you can immediately go back to it when the user presses "back".

Its contents can however be destroyed if the current top Activity takes up too much memory. The Android OS will free up the resources from the activities in the back stack in order to accommodate the needs of the foreground activity. In this event, the activity will effectively be "restarted" and must be rebuilt when the user presses "back".

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