I am still fairly new to understanding android and heard about activity stacks.
From what I read and understood was that it creates stack as you progress to each activity and leaves it behind as a stack item.
My question are:
-
Would removing an activity stack cause android to save more memory? eg. such as activity that has a lot of images.
-
Would it be better to remove activity stacks knowing that you want them to start from scratch in the first place?.
If there is anything that has to be corrected on my second sentence please mention it as well.
The
activity stackback stack is important because it allows a means of back navigation from screen to screen. Without it, there would be no “back button” navigation and the concept of a “task” wouldn’t exist. Android is optimized to manage memory for you (see the documentation on theActivitylifecycle). Activities that are placed on the back stack are still managed by the system; so long that you don’t do anything stupid, there shouldn’t be any problem. 🙂I’m not sure I’m understanding this question correctly, but the answer is most likely “no”. If you want to start from scratch (i.e. clear the back stack), then you can use the
FLAG_ACTIVITY_CLEAR_TOPflag when launching your new Activity.