SlideShare a Scribd company logo
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

More Related Content

What's hot

Shared preferences
Shared preferencesShared preferences
Shared preferences
Sourabh Sahu
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorageKrazy Koder
 
Android activity
Android activityAndroid activity
Android activityKrazy Koder
 
Fragment
Fragment Fragment
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
Mike Kvintus
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle瑋琮 林
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
Kumar
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Aly Abdelkareem
 
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
Dr. Ramkumar Lakshminarayanan
 
Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action bar
Diego Grancini
 
Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101
Arif Amirani
 
Android app development
Android app developmentAndroid app development
Android app development
Tanmoy Roy
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
Sergi Martínez
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
Benny Skogberg
 

What's hot (20)

Shared preferences
Shared preferencesShared preferences
Shared preferences
 
Android intent
Android intentAndroid intent
Android intent
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
Android activity
Android activityAndroid activity
Android activity
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Fragment
Fragment Fragment
Fragment
 
Android Services
Android ServicesAndroid Services
Android Services
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle
 
Android Multimedia Support
Android Multimedia SupportAndroid Multimedia Support
Android Multimedia Support
 
Android ui menu
Android ui menuAndroid ui menu
Android ui menu
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
 
Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action bar
 
Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101
 
Android app development
Android app developmentAndroid app development
Android app development
 
android layouts
android layoutsandroid layouts
android layouts
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 

Viewers also liked

Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
mssaman
 
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
 
Application lifecycle
Application lifecycleApplication lifecycle
Application lifecycle
Training Guide
 
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 listview
parmistech
 
Android Data Persistence
Android Data PersistenceAndroid Data Persistence
Android Data Persistence
Romain Rochegude
 
Persistence in Android
Persistence in AndroidPersistence in Android
Persistence in Android
ma-polimi
 
Android Custom view
Android Custom view Android Custom view
Android Custom view
Theodore(Yongbin) Cha
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected World
Christian 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.2
Vinaykumar Hebballi
 
Json vs Gson vs Jackson
Json vs Gson vs JacksonJson vs Gson vs Jackson
Json vs Gson vs Jackson
Vinaykumar Hebballi
 
Android Logging System
Android Logging SystemAndroid Logging System
Android Logging System
William Lee
 
The android activity lifecycle
The android activity lifecycleThe android activity lifecycle
The android activity lifecycle
Eng Chrispinus Onyancha
 
Android development - ListView & Adapter
Android development - ListView & AdapterAndroid development - ListView & Adapter
Android development - ListView & Adapter
Lope Emano
 
Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)
Ted Liang
 
Types of database
Types of databaseTypes of database
Types of database
faizan1712818
 
Types of Database Models
Types of Database ModelsTypes of Database Models
Types of Database Models
Murassa Gillani
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
Ashish Agrawal
 
Different type of databases
Different type of databasesDifferent type of databases
Different type of databases
Shwe Yee
 

Viewers also liked (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
 

Similar to 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
 
fragments-activity.pptx
fragments-activity.pptxfragments-activity.pptx
fragments-activity.pptx
SriKGangadharRaoAssi
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
PERKYTORIALS
 
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-116
PrathishGM
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
ssusere71a07
 
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 & views
ma-polimi
 
Lecture #4 activities & fragments
Lecture #4  activities & fragmentsLecture #4  activities & fragments
Lecture #4 activities & fragments
Vitali 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 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
 
Activities
ActivitiesActivities
Activities
Sourabh Sahu
 
Tk2323 lecture 11 process and thread
Tk2323 lecture 11   process and threadTk2323 lecture 11   process and thread
Tk2323 lecture 11 process and thread
MengChun 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 cycle
SV.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.pptx
ShantanuDharekar
 
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
 

Similar to 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)
 

More from University of Potsdam

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

More from 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
 

Recently uploaded

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 

Recently uploaded (20)

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 

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