Activity is the most common component in Android app and the most crucial. It is usually used to display information to the device screen but there also times that you do not have to provide a user interface with an activity. To implement an activity you need to follow some steps:
- Extend the Ativity class
- Override selected lifecycle/hook methods, those at the picture above
- define other methods or nested classes needed to implement the activity
- update the AndroidManifest.xml file to include the activity so Android OS knows about it.
An activity extends the Activity class which has lifecycle/hook methods that are called automatically when an event occurs. Those events are activity’s lifecycle events:
- initialized – activity initialized and onCreate() is called.
- created – activity created, it not visible neither is has focus. onStart() and onRestart() are called.
- Started No focus but visible, onResume() is called
- Resumed Has focus and it is visible. The activity can also be paused when another activity opens above it and destroyed by clicking the back button.
- Destroyed It is destroyed and OS can removed it from memory
END OF PART 1!!!
- Android – Notifications
- Content Provider – Part 3 – insert, delete, update, getType
- Content Provider – Part 2 – create and query