Tuesday, October 14, 2014

Android Tutorial Chapter 7

I'm using the regular tutorial; not the advanced one

This chapter focused on the "Android application activity life cycle" which basically means the process of a window being created and then destroyed which can be seen by the diagram below.
So from what it looks like an activity, or window, is first created and started which makes it fully visibly, then it can be paused which makes it partially visible. I'm guessing by partially visible it means that the window may be minimized or greyed out or something like that. Then it can either be resumed which makes it fully visible again or instead stopped which would hide it. I guess a hidden activity would be if you went to the menu of your phone or locked your phone and resumed the app later. The other option would be to destroy the app which would be closing the app all together or shutting off your phone, etc.
  • onCreate(): This is the first callback and called when the activity is first created. 
  • onStart(): This callback is called when the activity becomes visible to the user. 
  • onResume(): This is called when the user starts interacting with the application.
  • onPause(): The paused activity does not receive user input and cannot execute any code and called when the current activity is being paused and the previous activity is being resumed. 
  • onStop(): This callback is called when the activity is no longer visible. 
  • onDestroy(): This callback is called before the activity is destroyed by the system. 
  • onRestart(): This callback is called when the activity restarts after stopping it.
They also have an app to demonstrate this so I'll try running it ASAP.

1 comment:

  1. Excellent! With the link you provided, I could download the tutorials and look through them as I read your blog posts. At first I was surprised to see you on Chapter 7 without having developed any applications, but looking over the tutorial I can see that chapters are small, bite size in nature, which I think is a good thing. "Hello World" doesn't happen until Chapter 5.

    Are you using eclipse as your IDE? If you are not, I'm going to ask you to do that. The tutorials assume Eclipse, and the High School Programming Contest will also. You can make an early contribution to the team by learning your way around Eclipse now.

    ReplyDelete