Activity Lifecycle Basics

An image is worth a 1000 words.

workflow graph of android's activity lifecycle

Source

That image generally sums up the main beats of the Android Activity lifecycle. Knowing the lifecycle allows you to think about what your application should do as it goes through this lifecycle. What information you need to save to ensure the user has a consistent experience?

I’d really like to see how Twitter handles the lifecycle on it’s timeline activity. I admire how well, even when the app crashes, it’s able to maintain the exact position I was in on my twitter feed. Try it now! Open twitter, scroll midway through your feed, then close the app. Open it back up and you’ll be in the exact same position you were just in.

Read more →

Building Intents

Intents are a kind of messaging system used by Android activities to pass information back and forth. It helps keep a separation of concerns between activities.

There are two main types of intents: explicit and implicit.

Explicit intents are best used between activities within your own application, since they require the full class name in order for them to be started.

Here’s an example of starting an explicit intent. This would appear in an Activity class:

Read more →