Skip to content Skip to sidebar Skip to footer

Repeated Activity Initializations And Memory Usage

Thanks for reading by question, albeit a really noob-ish one... How does the Android system manage memory with regards to activity initialization, specifically if an activity is in

Solution 1:

The answer is: It depends. :-)

If you use the standard settings for the activities A, B and C, your application will run out of memory. The reason is that Android will keep each activity in the "Back Stack" that allows the user to navigate back by pushing the back button.

However, if you set the android:launchMode of your activities to singleTop in the AndroidManifest.xml file then Android will route the intents to the running instances of the activities by invoking onNewIntent() in the activity.

You can read more about it in the Android Developer Documentation regarding launch modes.

Post a Comment for "Repeated Activity Initializations And Memory Usage"