Skip to content

Instantly share code, notes, and snippets.

@jwill
Last active August 29, 2015 14:02
Show Gist options
  • Save jwill/6e10a96fb5cfde9dd3a3 to your computer and use it in GitHub Desktop.
Save jwill/6e10a96fb5cfde9dd3a3 to your computer and use it in GitHub Desktop.
t
Ok. So before Dan gets carried away with databases, let’s look at what happens when you use an Intent to transition between Activities.
Within Sunshine, if you tap on a list item in the MainActivity, it opens up the DetailActivity - but the MainActivity remains on the backstack, ready to reappear as soon as you hit back.
Now in that example, both Activities are within the same App, but as we learned in Lesson 3, you can also launch the browser or a maps app from Sunshine.
Or, for that matter, the user can hit home, or use the recent apps key to switch to another app -- or open a notification -- anything.
Keep in mind that resources on our devices are extremely limited, so it’s not a good idea to have dozens of apps sitting idle in the background. Android solves this for us, so you don’t have to use those awful task-killer apps.
So how does it do that? Well, it kills low priority applications that you haven’t used in a while.
We’ll go into detail on exactly how it figures out which app needs to die in Lesson 6, but for now, it’s important to realize that your app isn’t in control of its own destiny -- they can be killed at any time [topple easel] -- so you need to know how to deal with that.
And that means understanding the lifecycle of an Activity, and the signals we get from the framework to indicate its progress through it’s lifetime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment