Skip to content
Coding Fanatic
  • Android Development
  • News and Reviews
  • Road2Pro
  • Tutorials
  • Services
  • About

The Activity Stack, 45/100 Days of Code

  • September 16, 2019December 4, 2021
  • by Richard Clarke

When planning your application’s Activities, find ways to minimize the size of the Activity Stack.

The Activity Stack is used to keep track of every open Activity in your application. The more open Activities, the more memory used by your app.

Let’s go over the meaning of an open Activity. You can also find a video of my explanation at the bottom of this at the bottom of the page.

Let’s take the ClickingActivities project we’ve been working on for example. This app allows users to open each Activity by clicking a button. The first Activity lets you start the second, the second lets you start the third, and the third opens the first Activity.

As users continue to open Activities, the Activity Stack will grow and consume memory which can slow down a device and affect other resources as well.

To avoid this, we can add the second and third Activities as children of the first Activity. This way, users can access each Activity without adding multiple versions of each Activity to the Activity Stack. For more on this topic, click here

Next week I will show you how to edit our app to do just this.

Join the mailing list to see updates like this every week!
Coding Fanatic

Related

Clicking to Start Activities, 44/100 Days of Code
Setting a Parent Activity, 46/100 Days of Code
Richard Clarke
Richard is currently a developer using Java and Android Studio to build custom applications for Android. Richard tutored in mathematics at Montgomery College, and worked in Information Technology before entering the Software Development industry as a Quality Engineer.
100daysofcode Android AndroidDev

Related articles

I’d Tap That [SENSOR] –…
Where’s the Wifi? – News…
Android 12 RUINED One Handed…
Your New Favorite Stopwatch App!…
Two for Two BABY! 7…
…But the App is for…

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Join the mailing list!

This field is required.

Check your inbox or spam folder to confirm your subscription.

Follow me on social media!

  • GitHub
  • YouTube
  • X
  • Instagram
  • LinkedIn
My Tweets

Join the mailing list!

This field is required.

Check your inbox or spam folder to confirm your subscription.

Follow me on social media!

  • X
  • GitHub
  • LinkedIn
  • YouTube

Archives

Theme by Colorlib Powered by WordPress