Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stampycode committed Jun 17, 2017
1 parent 91ef330 commit 8e34870
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions worksheets/3-activity-lifecycle/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ The aim of this tutorial is to look at how the activity lifecycle works which lo

![](https://d2mxuefqeaa7sj.cloudfront.net/s_E25ED0FC0DF5A9B6B084CB936BAE886D8F9B2E37A2183F438D75F8F9BC39F410_1487708990139_file.png)

> for more information take a look at https://developer.android.com/guide/components/activities/activity-lifecycle.html There's also a really great video by Kristin Marsicano https://realm.io/news/activities-in-the-wild-exploring-the-activity-lifecycle-android/
> for more information take a look at (https://developer.android.com/guide/components/activities/activity-lifecycle.html)[] There's also a really great video by Kristin Marsicano (https://realm.io/news/activities-in-the-wild-exploring-the-activity-lifecycle-android/)[]
## 2. Logging

Firstly, we’re going to implement the different activity lifecycle methods. Android Studio has a lot of keyboard shortcuts which will write a lot of the code for us! On Mac OS Z press `Command + N` and on Windows press `Alt + Insert` . Here you can select `Override methods` and find the methods listed above.
Firstly, we’re going to implement the different activity lifecycle methods. Android Studio has a lot of keyboard shortcuts which will write a lot of the code for us! On Mac OS Z press <kbd>cmd</kbd>+<kbd>n</kbd> and on Windows press <kbd>Alt</kbd>+<kbd>Insert</kbd> . Here you can select `Override methods` and find the methods listed above.

We’re then going to write ourselves some Log messages. If you’ve ever written any JavaScript, this is the same as `console.log` . These we can check in the Android Monitor (probably a button at the bottom of your window in Android Studio) which methods are being called.
We’re then going to write ourselves some Log messages. If you’ve ever written any JavaScript, this is the same as `console.log`. These we can check in the Android Monitor (probably a button at the bottom of your window in Android Studio) which methods are being called.

When you first look in the Android Monitor, you’ll notice **a lot** of messages coming through. We can filter out which ones we care about by using a tag, like so:

Expand All @@ -33,9 +33,9 @@ When you first look in the Android Monitor, you’ll notice **a lot** of message
Run this on a real device (or an emulator) and test it out and answer with your coach the following questions:

a. What methods get called when the app first starts up?
b. What methods get called if I go home and come back into the app?
c. What methods get called if I kill the app, and then open it again?
1. What methods get called when the app first starts up?
2. What methods get called if I go home and come back into the app?
3. What methods get called if I kill the app, and then open it again?

## 3. Gotchas

Expand All @@ -45,7 +45,7 @@ Is that what you expected?

What other things could you do to your device that might destroy and re-create your activity? (Hint: changing the language)

![](https://d2mxuefqeaa7sj.cloudfront.net/s_E25ED0FC0DF5A9B6B084CB936BAE886D8F9B2E37A2183F438D75F8F9BC39F410_1487709473122_test.png) Speak to your coach about your coach and see where they’ve learned the hard way about the activity lifecycle! Has it ever caused an app they’ve written to crash, or behave in a way they didn’t intend for?
![](https://d2mxuefqeaa7sj.cloudfront.net/s_E25ED0FC0DF5A9B6B084CB936BAE886D8F9B2E37A2183F438D75F8F9BC39F410_1487709473122_test.png) Speak to your coach about your coach and see where they’ve learned the hard way about the activity lifecycle! Has it ever caused an app they’ve written to crash, or behave in a way they didn’t intend?

## 4. Pop quiz

Expand Down

0 comments on commit 8e34870

Please sign in to comment.