Android Project Structure and Lifecycle
Android Project Structure and Lifecycle
DEVELOPMENT
2
ANDROID PROJECT STRUCTURE
3
ANDROID PROJECT STRUCTURE CONT.
4
INTRODUCTION TO ACTIVITIES
6
THE ACTIVITY LIFECYCLE
An Android app uses states to determine
what to do.
An activity transitions between seven stages
of lifecycle
The parent Activity class provides a core set
of seven callbacks that should be overridden
to drive the expect behavior:
–onCreate()
–onStart()
–onResume()
–onPause()
–onStop()
–onRestart() 7
–onDestroy()
THE ONCREATE() METHOD
9
THE ONRESUME() METHOD
This is invoked when the activity enters the
Resumed state and it is visible on the
foreground.
10
THE ONPAUSE() METHOD
The system calls this method as the first
indication that the user is leaving your
activity
11
THE ONSTOP() METHOD
This is invoked when the activity is no longer
visible to the user.
12
THE ONRESTART() METHOD
The system invokes this callback when an
activity in the Stopped state is about to
restart.
13
THE ONDESTROY() METHOD
The system invokes this callback before an
activity is destroyed.
14