SlideShare une entreprise Scribd logo
1  sur  30
5/30/2015 1
Presented By:
Md: Delwar Hossain
Daffodil International University
Dept. of CSE
Android Apps Developer
5/30/2015 2
Today's Discussion: (1st Session)
 Activity Lifecycle Overview.
Activity Lifecycle testing (Implementation of
activity lifecycle methods).
Why need to know about Activity Lifecycle.
ListView basics (ListView widget, Array
adapter)
Simple project: Contact List (Implementation
of ListView, ArrayAdapter)
5/30/2015 3
Today's Discussion: ( 2nd Session)
About Shared Preferences
About Options Menu
Final project: Student Informat
System(Implementation of Shared
Preferences, Insert, Edit, Update, Delete)
5/30/2015 4
Activity Lifecycle Overview
An application consists of one or more
components that are defined in the
application's manifest file. A component can
be one of the following:
1. An Activity
2. A Service
3. A broadcast receiver
4. A content provider
5/30/2015 5
Activity Lifecycle Overview
• An activity usually presents a single visual user
interface from which a number of actions could be
performed.
• Although activities work together to form a cohesive
user interface, each activity is independent of the
others.
• Typically, one of the activities is marked as the first one
that should be presented to the user when the
application is launched.
• Moving from one activity to another is accomplished
by having the current activity start the next one
through so called intents.
5/30/2015 6
Activity Lifecycle Overview(Service)
• A service doesn't have a visual user interface,
but rather runs in the background for an
indefinite period of time.
5/30/2015 7
Activity Lifecycle Overview(Broadcast receiver)
A broadcast receiver is a component that does
nothing but receive and react to broadcast
announcements.
Broadcast receivers do not display a user
interface. However, they may start an activity
in response to the information they receive, or
‐ as services do ‐ they may use the notification
manager to alert the user.
5/30/2015 8
Android Applications
• Every Android application runs in its own
process(with its own instance of the Dalvik virtual
machine)
Whenever there's a request that should be
handled by a particular component
 Android makes sure that the application process
of the component is running,
 starting it if necessary, and
that an appropriate instance of the component is
available, creating the instance if necessary.
5/30/2015 9
Activity Stack
• Activities in the system are managed as an activity
stack.
• When a new activity is started, it is placed on the
top of the stack and becomes the running activity
‐‐ the previous activity always remains below it in
the stack, and will not come to the foreground
again until the new activity exits.
• If the user presses the Back Button the next
activity on the stack moves up and becomes
active.
5/30/2015 10
Activity Stack
5/30/2015 11
Life Cycle States
An activity has essentially three states:
1. It is active or running
2. It is paused or
3. It is stopped .
5/30/2015 12
Activity Lifecycle(Figure)
5/30/2015 13
Life Cycle States
1. It is active or running when it is in the
foreground of the screen(at the top of the
activity stack for the current task).This is the
activity that is the focus for the user's actions.
5/30/2015 14
Life Cycle States
2. It is paused if it has lost focus but is still
visible to the user. That is, another activity lies
on top of it and that new activity either is
transparent or doesn't cover the full screen.
But can be killed by the system in extreme low
memory situations.
5/30/2015 15
Life Cycle States
3. It is stopped if it is completely obscured by
another activity. It still retains all state and
member information. However, it is no longer
visible to the user so its window is hidden and
it will often be killed by the system when
memory is needed elsewhere.
5/30/2015 16
Life Cycle Methods
Method: onCreate()
• Called when the activity is first created.
• This is where you should do all of your normal
static set up —create views, bind data to lists, and
so on.
• This method is passed a Bundle object containing
the activity's previous state, if that state was
captured.
• Always followed by onStart()
5/30/2015 17
Life Cycle Methods
Method: onStart()
 Called just before the activity becomes visible
to the user.
 Followed by onResume() if the activity comes
to the foreground,or onStop() if it becomes
hidden.
5/30/2015 18
Life Cycle Methods
Method: onRestart()
• Called after the activity has been stopped, just
prior to it being started again.
• Always followed by onStart()
5/30/2015 19
Life Cycle Methods
Method: onResume()
1. Called just before the activity starts
interacting with the user.
2. At this point the activity is at the top of the
activity stack, with user input going to it.
3. Always followed by onPause().
5/30/2015 20
Life Cycle Methods
Method: onStop()
1. Called when the activity is no longer visible to the
user.
2. This may happen because it is being destroyed,
or because another activity (either an existing
one or a new one) has been resumed and is
covering it.
3. Followed either by onRestart() if the activity is
coming back to interact with the user, or by
onDestroy() if this activity is going away.
4. The activity in this state is killable by the system.
5/30/2015 21
Life Cycle Methods
Method: onDestroy()
1. Called before the activity is destroyed.
2. This is the final call that the activity will receive.
3. It could be called either because the activity is
finishing (someone called finish() on it), or
because the system is temporarily destroying this
instance of the activity to save space.
4. You can distinguish between these two scenarios
with the isFinishing() method.
5. The activity in this state is killable by the system.
5/30/2015 22
List View
5/30/2015 23
List View
5/30/2015 24
List View
5/30/2015 25
5/30/2015 26
5/30/2015 27
5/30/2015 28
Shared Preferences
5/30/2015 29
Questions ?
5/30/2015 30

Contenu connexe

Tendances

Android datastorage
Android datastorageAndroid datastorage
Android datastorage
Krazy Koder
 

Tendances (20)

Supporting multiple screens on android
Supporting multiple screens on androidSupporting multiple screens on android
Supporting multiple screens on android
 
Android Components
Android ComponentsAndroid Components
Android Components
 
Android Data Storagefinal
Android Data StoragefinalAndroid Data Storagefinal
Android Data Storagefinal
 
PPT on iOS
PPT on iOS PPT on iOS
PPT on iOS
 
Android intent
Android intentAndroid intent
Android intent
 
Android Location and Maps
Android Location and MapsAndroid Location and Maps
Android Location and Maps
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
7 Deadlocks
7 Deadlocks7 Deadlocks
7 Deadlocks
 
05 intent
05 intent05 intent
05 intent
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android resources
Android resourcesAndroid resources
Android resources
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
Google Maps in Android
Google Maps in AndroidGoogle Maps in Android
Google Maps in Android
 
Android Widget
Android WidgetAndroid Widget
Android Widget
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android intents
Android intentsAndroid intents
Android intents
 
Android UI
Android UIAndroid UI
Android UI
 
Android Development Tools Overview
Android Development Tools OverviewAndroid Development Tools Overview
Android Development Tools Overview
 

En vedette

android architecture,life cycle,sdk,execution process
android architecture,life cycle,sdk,execution processandroid architecture,life cycle,sdk,execution process
android architecture,life cycle,sdk,execution process
Deepa Rani
 

En vedette (20)

Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
 
android architecture,life cycle,sdk,execution process
android architecture,life cycle,sdk,execution processandroid architecture,life cycle,sdk,execution process
android architecture,life cycle,sdk,execution process
 
Application lifecycle
Application lifecycleApplication lifecycle
Application lifecycle
 
AAL Forum - OHA: Open Health Assistant Care Management & Services Integratio...
AAL Forum - OHA: Open Health Assistant Care Management  & Services Integratio...AAL Forum - OHA: Open Health Assistant Care Management  & Services Integratio...
AAL Forum - OHA: Open Health Assistant Care Management & Services Integratio...
 
Android custom listview
Android custom listviewAndroid custom listview
Android custom listview
 
Android Data Persistence
Android Data PersistenceAndroid Data Persistence
Android Data Persistence
 
Persistence in Android
Persistence in AndroidPersistence in Android
Persistence in Android
 
Android Custom view
Android Custom view Android Custom view
Android Custom view
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected World
 
Open Ldap Integration and Configuration with Lifray 6.2
Open Ldap Integration and Configuration with Lifray 6.2Open Ldap Integration and Configuration with Lifray 6.2
Open Ldap Integration and Configuration with Lifray 6.2
 
Json vs Gson vs Jackson
Json vs Gson vs JacksonJson vs Gson vs Jackson
Json vs Gson vs Jackson
 
Android Logging System
Android Logging SystemAndroid Logging System
Android Logging System
 
The android activity lifecycle
The android activity lifecycleThe android activity lifecycle
The android activity lifecycle
 
Android development - ListView & Adapter
Android development - ListView & AdapterAndroid development - ListView & Adapter
Android development - ListView & Adapter
 
Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)
 
Types of database
Types of databaseTypes of database
Types of database
 
Types of Database Models
Types of Database ModelsTypes of Database Models
Types of Database Models
 
Slides chapter 3
Slides chapter 3Slides chapter 3
Slides chapter 3
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Different type of databases
Different type of databasesDifferent type of databases
Different type of databases
 

Similaire à Google android Activity lifecycle

Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities
Ahsanul Karim
 
Android activity
Android activityAndroid activity
Android activity
MohNage7
 
Threads handlers and async task, widgets - day8
Threads   handlers and async task, widgets - day8Threads   handlers and async task, widgets - day8
Threads handlers and async task, widgets - day8
Utkarsh Mankad
 
Android activity
Android activityAndroid activity
Android activity
Krazy Koder
 
Android activity
Android activityAndroid activity
Android activity
Krazy Koder
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2
DHIRAJ PRAVIN
 
android_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semandroid_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last sem
aswinbiju1652
 
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
MugiiiReee
 
Lecture 06
Lecture 06Lecture 06
Lecture 06
Rana Ali
 

Similaire à Google android Activity lifecycle (20)

Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities
 
Android activity
Android activityAndroid activity
Android activity
 
fragments-activity.pptx
fragments-activity.pptxfragments-activity.pptx
fragments-activity.pptx
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
Threads handlers and async task, widgets - day8
Threads   handlers and async task, widgets - day8Threads   handlers and async task, widgets - day8
Threads handlers and async task, widgets - day8
 
Mad textbook 63-116
Mad textbook 63-116Mad textbook 63-116
Mad textbook 63-116
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
 
Android activity
Android activityAndroid activity
Android activity
 
Android activity
Android activityAndroid activity
Android activity
 
Android
AndroidAndroid
Android
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
Lecture #4 activities & fragments
Lecture #4  activities & fragmentsLecture #4  activities & fragments
Lecture #4 activities & fragments
 
android_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semandroid_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last sem
 
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx11.11.2020 - Unit 5-3  ACTIVITY, MENU AND SQLITE DATABASE.pptx
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
 
Activities
ActivitiesActivities
Activities
 
Tk2323 lecture 11 process and thread
Tk2323 lecture 11   process and threadTk2323 lecture 11   process and thread
Tk2323 lecture 11 process and thread
 
Lecture 06
Lecture 06Lecture 06
Lecture 06
 
App anatomy and life cycle
App anatomy and life cycleApp anatomy and life cycle
App anatomy and life cycle
 

Plus de University of Potsdam

Plus de University of Potsdam (20)

Computer fundamentals 01
Computer fundamentals 01Computer fundamentals 01
Computer fundamentals 01
 
Workshop on android apps development
Workshop on android apps developmentWorkshop on android apps development
Workshop on android apps development
 
Transparency and concurrency
Transparency and concurrencyTransparency and concurrency
Transparency and concurrency
 
Database System Architecture
Database System ArchitectureDatabase System Architecture
Database System Architecture
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
indexing and hashing
indexing and hashingindexing and hashing
indexing and hashing
 
data recovery-raid
data recovery-raiddata recovery-raid
data recovery-raid
 
Query processing
Query processingQuery processing
Query processing
 
Machine Learning for Data Mining
Machine Learning for Data MiningMachine Learning for Data Mining
Machine Learning for Data Mining
 
Tree, function and graph
Tree, function and graphTree, function and graph
Tree, function and graph
 
Sonet
SonetSonet
Sonet
 
Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
Series parallel ac rlc networks
Series parallel ac rlc networksSeries parallel ac rlc networks
Series parallel ac rlc networks
 
Series parallel ac networks
Series parallel ac networksSeries parallel ac networks
Series parallel ac networks
 
Relations
RelationsRelations
Relations
 
Relations
RelationsRelations
Relations
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Prim algorithm
Prim algorithmPrim algorithm
Prim algorithm
 

Dernier

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Dernier (20)

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 

Google android Activity lifecycle

  • 2. Presented By: Md: Delwar Hossain Daffodil International University Dept. of CSE Android Apps Developer 5/30/2015 2
  • 3. Today's Discussion: (1st Session)  Activity Lifecycle Overview. Activity Lifecycle testing (Implementation of activity lifecycle methods). Why need to know about Activity Lifecycle. ListView basics (ListView widget, Array adapter) Simple project: Contact List (Implementation of ListView, ArrayAdapter) 5/30/2015 3
  • 4. Today's Discussion: ( 2nd Session) About Shared Preferences About Options Menu Final project: Student Informat System(Implementation of Shared Preferences, Insert, Edit, Update, Delete) 5/30/2015 4
  • 5. Activity Lifecycle Overview An application consists of one or more components that are defined in the application's manifest file. A component can be one of the following: 1. An Activity 2. A Service 3. A broadcast receiver 4. A content provider 5/30/2015 5
  • 6. Activity Lifecycle Overview • An activity usually presents a single visual user interface from which a number of actions could be performed. • Although activities work together to form a cohesive user interface, each activity is independent of the others. • Typically, one of the activities is marked as the first one that should be presented to the user when the application is launched. • Moving from one activity to another is accomplished by having the current activity start the next one through so called intents. 5/30/2015 6
  • 7. Activity Lifecycle Overview(Service) • A service doesn't have a visual user interface, but rather runs in the background for an indefinite period of time. 5/30/2015 7
  • 8. Activity Lifecycle Overview(Broadcast receiver) A broadcast receiver is a component that does nothing but receive and react to broadcast announcements. Broadcast receivers do not display a user interface. However, they may start an activity in response to the information they receive, or ‐ as services do ‐ they may use the notification manager to alert the user. 5/30/2015 8
  • 9. Android Applications • Every Android application runs in its own process(with its own instance of the Dalvik virtual machine) Whenever there's a request that should be handled by a particular component  Android makes sure that the application process of the component is running,  starting it if necessary, and that an appropriate instance of the component is available, creating the instance if necessary. 5/30/2015 9
  • 10. Activity Stack • Activities in the system are managed as an activity stack. • When a new activity is started, it is placed on the top of the stack and becomes the running activity ‐‐ the previous activity always remains below it in the stack, and will not come to the foreground again until the new activity exits. • If the user presses the Back Button the next activity on the stack moves up and becomes active. 5/30/2015 10
  • 12. Life Cycle States An activity has essentially three states: 1. It is active or running 2. It is paused or 3. It is stopped . 5/30/2015 12
  • 14. Life Cycle States 1. It is active or running when it is in the foreground of the screen(at the top of the activity stack for the current task).This is the activity that is the focus for the user's actions. 5/30/2015 14
  • 15. Life Cycle States 2. It is paused if it has lost focus but is still visible to the user. That is, another activity lies on top of it and that new activity either is transparent or doesn't cover the full screen. But can be killed by the system in extreme low memory situations. 5/30/2015 15
  • 16. Life Cycle States 3. It is stopped if it is completely obscured by another activity. It still retains all state and member information. However, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere. 5/30/2015 16
  • 17. Life Cycle Methods Method: onCreate() • Called when the activity is first created. • This is where you should do all of your normal static set up —create views, bind data to lists, and so on. • This method is passed a Bundle object containing the activity's previous state, if that state was captured. • Always followed by onStart() 5/30/2015 17
  • 18. Life Cycle Methods Method: onStart()  Called just before the activity becomes visible to the user.  Followed by onResume() if the activity comes to the foreground,or onStop() if it becomes hidden. 5/30/2015 18
  • 19. Life Cycle Methods Method: onRestart() • Called after the activity has been stopped, just prior to it being started again. • Always followed by onStart() 5/30/2015 19
  • 20. Life Cycle Methods Method: onResume() 1. Called just before the activity starts interacting with the user. 2. At this point the activity is at the top of the activity stack, with user input going to it. 3. Always followed by onPause(). 5/30/2015 20
  • 21. Life Cycle Methods Method: onStop() 1. Called when the activity is no longer visible to the user. 2. This may happen because it is being destroyed, or because another activity (either an existing one or a new one) has been resumed and is covering it. 3. Followed either by onRestart() if the activity is coming back to interact with the user, or by onDestroy() if this activity is going away. 4. The activity in this state is killable by the system. 5/30/2015 21
  • 22. Life Cycle Methods Method: onDestroy() 1. Called before the activity is destroyed. 2. This is the final call that the activity will receive. 3. It could be called either because the activity is finishing (someone called finish() on it), or because the system is temporarily destroying this instance of the activity to save space. 4. You can distinguish between these two scenarios with the isFinishing() method. 5. The activity in this state is killable by the system. 5/30/2015 22