Mobile Computing · User navigates back to the activity. Process is killed. Other applications need...
Transcript of Mobile Computing · User navigates back to the activity. Process is killed. Other applications need...
![Page 1: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/1.jpg)
Mobile ComputingLECTURE # 3
![Page 2: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/2.jpg)
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
![Page 3: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/3.jpg)
Activity and its life cycle
![Page 4: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/4.jpg)
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.
![Page 5: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/5.jpg)
Activity Life Cycle
![Page 6: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/6.jpg)
How Activity Life Cycle Works?
![Page 7: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/7.jpg)
OnCreate() Event
• Called when Activity is created
• Normally all the initialization are done in this method
![Page 8: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/8.jpg)
OnStart() Event
• Called when Activity is becoming visible to the User
![Page 9: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/9.jpg)
OnRestart() Event
• Called when Activity is stopped and restarting
![Page 10: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/10.jpg)
OnResume() Event
• Called when Activity is available for interacting
• Called when Activity is in the foreground
![Page 11: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/11.jpg)
OnPause() Event
• Called when System is about to resume some other activity
• Called when System is about to start another activity
![Page 12: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/12.jpg)
OnStop() Event
• Called when Activity is no longer visible to User
![Page 13: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/13.jpg)
OnDestroy() Event
• Final call before the Activity is destroyed
• Activity can be destroyed manually by user or Automatically by System
![Page 14: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/14.jpg)
Android Activities work in Stack
![Page 15: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/15.jpg)
Switching Between Activities
![Page 16: Mobile Computing · User navigates back to the activity. Process is killed. Other applications need memory. Activity starts. onCreate() onStart() onResume() Activity is running.](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed83c610fa3e705ec0e171d/html5/thumbnails/16.jpg)
Switching Between Activities