SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Android architecture
Android architectureAndroid architecture
Android architecture
 
Android resources
Android resourcesAndroid resources
Android resources
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
Android activity
Android activityAndroid activity
Android activity
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
 
04 activities and activity life cycle
04 activities and activity life cycle04 activities and activity life cycle
04 activities and activity life cycle
 
PPT on Android Applications
PPT on Android ApplicationsPPT on Android Applications
PPT on Android Applications
 
Android intents
Android intentsAndroid intents
Android intents
 
Android SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaAndroid SDK Tutorial | Edureka
Android SDK Tutorial | Edureka
 
android activity
android activityandroid activity
android activity
 
How to Customize Android Framework&System
How to Customize Android Framework&SystemHow to Customize Android Framework&System
How to Customize Android Framework&System
 
Android activity
Android activityAndroid activity
Android activity
 
Event handling
Event handlingEvent handling
Event handling
 
Mobile application development ppt
Mobile application development pptMobile application development ppt
Mobile application development ppt
 
Android ui dialog
Android ui dialogAndroid ui dialog
Android ui dialog
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
android content providers
android content providersandroid content providers
android content providers
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development ppt
 
Manipulating Android tasks and back stack
Manipulating Android tasks and back stackManipulating Android tasks and back stack
Manipulating Android tasks and back stack
 
Android Jetpack
Android Jetpack Android Jetpack
Android Jetpack
 

Andere mochten auch

Android life cycle
Android life cycleAndroid life cycle
Android life cycle瑋琮 林
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cyclemssaman
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycleKumar
 
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 processDeepa Rani
 
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...Ándago
 
Android custom listview
Android custom listviewAndroid custom listview
Android custom listviewparmistech
 
Persistence in Android
Persistence in AndroidPersistence in Android
Persistence in Androidma-polimi
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldChristian Melchior
 
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.2Vinaykumar Hebballi
 
Android Logging System
Android Logging SystemAndroid Logging System
Android Logging SystemWilliam Lee
 
Android development - ListView & Adapter
Android development - ListView & AdapterAndroid development - ListView & Adapter
Android development - ListView & AdapterLope Emano
 
Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Ted Liang
 
Types of Database Models
Types of Database ModelsTypes of Database Models
Types of Database ModelsMurassa Gillani
 

Andere mochten auch (20)

Android life cycle
Android life cycleAndroid life cycle
Android life cycle
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
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
 

Ähnlich wie 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 activityMohNage7
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intentPERKYTORIALS
 
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 - day8Utkarsh Mankad
 
Mad textbook 63-116
Mad textbook 63-116Mad textbook 63-116
Mad textbook 63-116PrathishGM
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdfssusere71a07
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2DHIRAJ PRAVIN
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & viewsma-polimi
 
Lecture #4 activities & fragments
Lecture #4  activities & fragmentsLecture #4  activities & fragments
Lecture #4 activities & fragmentsVitali Pekelis
 
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 semaswinbiju1652
 
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.pptxMugiiiReee
 
Tk2323 lecture 11 process and thread
Tk2323 lecture 11   process and threadTk2323 lecture 11   process and thread
Tk2323 lecture 11 process and threadMengChun Lam
 
Lecture 06
Lecture 06Lecture 06
Lecture 06Rana Ali
 
App anatomy and life cycle
App anatomy and life cycleApp anatomy and life cycle
App anatomy and life cycleSV.CO
 
Unit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxUnit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxShantanuDharekar
 
02 programmation mobile - android - (activity, view, fragment)
02 programmation mobile - android - (activity, view, fragment)02 programmation mobile - android - (activity, view, fragment)
02 programmation mobile - android - (activity, view, fragment)TECOS
 

Ähnlich wie Google android Activity lifecycle (20)

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
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
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
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
 
Unit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxUnit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptx
 
02 programmation mobile - android - (activity, view, fragment)
02 programmation mobile - android - (activity, view, fragment)02 programmation mobile - android - (activity, view, fragment)
02 programmation mobile - android - (activity, view, fragment)
 

Mehr von 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
 

Kürzlich hochgeladen

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 

Kürzlich hochgeladen (20)

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 

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