mobile computing · user navigates back to the activity. process is killed. other applications need...
TRANSCRIPT
Mobile ComputingLECTURE # 3
The CourseCourse Code: IT-4545
Course Title: Mobile Computing
Instructor: JAWAD AHMAD◦ Email Address: [email protected]
Web Address: http://csandituoslahore.weebly.com/mc.html
Term (Semester): Spring 2018
Duration: 15/16 Weeks
Activity and its life cycle
What is an Activity?
• Activity is a window that contains GUI.
• An Application can have 1or more Activities.
• Android Applications normally have several
Activities.
• Several Activities together make an
Application.
• User interacts with Activity.
• Activities are built independent of each other.
Activity Life Cycle
How Activity Life Cycle Works?
OnCreate() Event
• Called when Activity is created
• Normally all the initialization are done in this method
OnStart() Event
• Called when Activity is becoming visible to the User
OnRestart() Event
• Called when Activity is stopped and restarting
OnResume() Event
• Called when Activity is available for interacting
• Called when Activity is in the foreground
OnPause() Event
• Called when System is about to resume some other activity
• Called when System is about to start another activity
OnStop() Event
• Called when Activity is no longer visible to User
OnDestroy() Event
• Final call before the Activity is destroyed
• Activity can be destroyed manually by user or Automatically by System
Android Activities work in Stack
Switching Between Activities
Switching Between Activities