1 / 7

Activity Lifecycle

Activity Lifecycle. Activity States . Active (running) An active activity is visible on the screen and has the focus. This is the activity the user is interacting with. P aused

jania
Download Presentation

Activity Lifecycle

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Activity Lifecycle Fall 2012 CS2302: Programming Principles

  2. Activity States • Active (running) • An active activity is visible on the screen and has the focus. This is the activity the user is interacting with. • Paused • A paused activity is visible on the screen but doesn’t have the focus. A paused activity can be killed when its memory is needed by the OS. • Stopped • A stopped activity is not visible on the screen and is likely to be killed by the system when its memory is needed. Fall 2012 CS2302: Programming Principles

  3. Lifecycle Events • onCreate() • onStart() • onResume() • onPause() • onRestart() • onStop() • onDestroy() Fall 2012 CS2302: Programming Principles

  4. Start the first Activity • FirstActivity • onCreate • onStart • onResume Fall 2012 CS2302: Programming Principles

  5. Start the second Activity from the first Activity • FirstActivity • onPause • SecondActivity • onCreate • onStart • onResume • FirstActivity • onStop Fall 2012 CS2302: Programming Principles

  6. Come back to the first Activity • SecondActivity • onPause • FirstActivity • onRestart • onStart • onResume • SecondActivity • onStop Fall 2012 CS2302: Programming Principles

  7. Summary Fall 2012 CS2302: Programming Principles

More Related