ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Android ¨C
Message
Yong Heui Cho @ Mokwon University
Some of slides are referred to:
[1] Nitin Ramchandani, Android OS, slideshare.
2
Application
Application Structure
Activity
Context
OS
Resources
Service
lifecycle
3
Application Lifecycle
I. In Android, every application runs in their
own process.
II. Processes are started or stopped as needed
to run application components.
III. A process may be killed to reclaim resources.
¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
4
Activity Lifecycle (I)
5
? onCreate(Bundle): This is called when the activity first
starts up.
?onStart( ): This indicates the activity is about to be
displayed to the user.
? onResume( ): This is called when your activity can start
interacting with the user. This is a good place to start
animations and music.
? onPause( ): This runs when the activity is about to go
into the background, usually because another activity has
been launched in front of it. This is where you should save
your program¡¯s persistent state, such as a database record
being edited.
Activity Lifecycle (II)
¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
6
? onStop( ): This is called when your activity is no longer
visible to the user and it won¡¯t be needed for a while. If
memory is tight, onStop( ) may never be called (the system
may simply terminate your process).
? onRestart( ): If this method is called, it indicates your
activity is being redisplayed to the user from a stopped state.
? onDestroy( ): This is called right before your activity is
destroyed. If memory is tight, onDestroy( ) may never be
called (the system may simply terminate your process).
Activity Lifecycle (III)
¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
7
?onSaveInstanceState(Bundle): Android will call this
method to allow the activity to save per-instance state,
such as a cursor position within a text field. Usually you
won¡¯t need to override it because the default
implementation saves the state for all your user interface
controls automatically.
? onRestoreInstanceState(Bundle): This is called when
the activity is being reinitialized from a state previously
saved by the onSaveInstanceState( ) method. The default
implementation restores the state of your user interface.
Save & Restore
¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
8
Lifecycle Comparison
Run Terminate
onCreate() onDestroy()
onStart() onStop()
onResume() onPause()
onRestart() -
onRestoreInstanceState() onSaveInstanceState()
9
Summary of Lifecycle
10
Android vs. Windows
type Android Windows
CPU optimal fast
battery small power supply
memory
mobile DRAM
small
DRAM
large
message handler
message (Message)
or action (String)
message (int)
termination app lifecycle permanent
function call call & proceed
call & wait
or call & proceed
11
MVC Components
12
Android Msg Handler
? Message: containing a description and arbitrary data
object
? Runnable: a command that can be executed
? Handler: allows you to send and process Message and
Runnable
? Looper: used to run a message loop for a thread
13
Concept of Multithread
14
Android Rules
? Do not block the UI thread (or main
thread).
? Do not access the Android UI toolkit
from outside the UI thread.
15
Context
? Interface to global information about an
application environment
? Uses of context
¨C Creating new objects
¨C Accessing standard common resources
¨C Accessing components implicitly
Activity
Context
OS
16
Access of Context
? this
¨C Activity extends Context
? View.getContext()
¨C Context for View (usually Activity Context)
? Activity.getApplicationContext()
¨C Permanent Application Context
? ContextWrapper.getBaseContext()
¨C Access to another Context
Ad

Recommended

Zk meetup talk
Zk meetup talk
Yisheng Liao
?
Android - Message
Android - Message
Yong Heui Cho
?
Inside the Android application framework - Google I/O 2009
Inside the Android application framework - Google I/O 2009
Viswanath J
?
Dori waldman android _course
Dori waldman android _course
Dori Waldman
?
Android life cycle
Android life cycle
¬|çý ÁÖ
?
Dori waldman android _course_2
Dori waldman android _course_2
Dori Waldman
?
Android
Android
Natasha Ram¨ªrez
?
Inside the android_application_framework
Inside the android_application_framework
surendray
?
Anatomy of android application
Anatomy of android application
Nikunj Dhameliya
?
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
Osahon Gino Ediagbonya
?
Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
?
App Fundamentals and Activity life cycle.pptx
App Fundamentals and Activity life cycle.pptx
ridzah12
?
Android Lifecycle Basics in Practice.
Android Lifecycle Basics in Practice.
¥Ê¥à-Nam Nguy?n
?
Android lifecycle
Android lifecycle
baabtra.com - No. 1 supplier of quality freshers
?
Android Framework
Android Framework
CodeAndroid
?
Marakana android-java developers
Marakana android-java developers
Marko Gargenta
?
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt
NagarajKalligudd1
?
Unit2
Unit2
DevaKumari Vijay
?
Activity lifecycle
Activity lifecycle
Rehan Choudhary
?
Activity
Activity
roopa_slide
?
Activity
Activity
NikithaNag
?
Activity
Activity
NikithaNag
?
Activity
Activity
roopa_slide
?
Android Architecture v2 presetnation extension
Android Architecture v2 presetnation extension
RishiRajeshSharma
?
Android101
Android101
David Marques
?
Introduction to Android Development
Introduction to Android Development
Aly Abdelkareem
?
Google android Activity lifecycle
Google android Activity lifecycle
University of Potsdam
?
Android basics
Android basics
Ankit Agrawal
?
Android - Sensor Manager
Android - Sensor Manager
Yong Heui Cho
?
Android - Broadcast Receiver
Android - Broadcast Receiver
Yong Heui Cho
?

More Related Content

Similar to Android - Message (20)

Anatomy of android application
Anatomy of android application
Nikunj Dhameliya
?
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
Osahon Gino Ediagbonya
?
Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
?
App Fundamentals and Activity life cycle.pptx
App Fundamentals and Activity life cycle.pptx
ridzah12
?
Android Lifecycle Basics in Practice.
Android Lifecycle Basics in Practice.
¥Ê¥à-Nam Nguy?n
?
Android lifecycle
Android lifecycle
baabtra.com - No. 1 supplier of quality freshers
?
Android Framework
Android Framework
CodeAndroid
?
Marakana android-java developers
Marakana android-java developers
Marko Gargenta
?
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt
NagarajKalligudd1
?
Unit2
Unit2
DevaKumari Vijay
?
Activity lifecycle
Activity lifecycle
Rehan Choudhary
?
Activity
Activity
roopa_slide
?
Activity
Activity
NikithaNag
?
Activity
Activity
NikithaNag
?
Activity
Activity
roopa_slide
?
Android Architecture v2 presetnation extension
Android Architecture v2 presetnation extension
RishiRajeshSharma
?
Android101
Android101
David Marques
?
Introduction to Android Development
Introduction to Android Development
Aly Abdelkareem
?
Google android Activity lifecycle
Google android Activity lifecycle
University of Potsdam
?
Android basics
Android basics
Ankit Agrawal
?

More from Yong Heui Cho (20)

Android - Sensor Manager
Android - Sensor Manager
Yong Heui Cho
?
Android - Broadcast Receiver
Android - Broadcast Receiver
Yong Heui Cho
?
Cloud Computing
Cloud Computing
Yong Heui Cho
?
Computing Paradigm
Computing Paradigm
Yong Heui Cho
?
TestBCD2018-2(answer)
TestBCD2018-2(answer)
Yong Heui Cho
?
TestSDS2018-2(answer)
TestSDS2018-2(answer)
Yong Heui Cho
?
TestEC2018-2(answer)
TestEC2018-2(answer)
Yong Heui Cho
?
TestEC2018-1(answer)
TestEC2018-1(answer)
Yong Heui Cho
?
TestBCD2018-1(answer)
TestBCD2018-1(answer)
Yong Heui Cho
?
TestSDS2018-1(answer)
TestSDS2018-1(answer)
Yong Heui Cho
?
BJT - Analysis of Bias
BJT - Analysis of Bias
Yong Heui Cho
?
TestCloud2018-2(answer)
TestCloud2018-2(answer)
Yong Heui Cho
?
TestECD2018-1(answer)
TestECD2018-1(answer)
Yong Heui Cho
?
Test-SDIC2018-2(answer)
Test-SDIC2018-2(answer)
Yong Heui Cho
?
TestCloud2018-1(answer)
TestCloud2018-1(answer)
Yong Heui Cho
?
Cloud Service Model
Cloud Service Model
Yong Heui Cho
?
Test-SDIC2018-1(Answer)
Test-SDIC2018-1(Answer)
Yong Heui Cho
?
RF ??? ??(Design of RF Amplifier)-rev1
RF ??? ??(Design of RF Amplifier)-rev1
Yong Heui Cho
?
Computing Paradigm - rev1
Computing Paradigm - rev1
Yong Heui Cho
?
Cloud Deployment Model
Cloud Deployment Model
Yong Heui Cho
?
Ad

Recently uploaded (20)

A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
?
Simplify Task, Team, and Project Management with Orangescrum Work
Simplify Task, Team, and Project Management with Orangescrum Work
Orangescrum
?
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
?
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
?
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
?
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
?
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
?
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
?
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
?
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
?
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
?
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
?
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
?
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
?
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
?
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
?
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
?
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
?
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
?
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Philip Schwarz
?
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
?
Simplify Task, Team, and Project Management with Orangescrum Work
Simplify Task, Team, and Project Management with Orangescrum Work
Orangescrum
?
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
?
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
?
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
?
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
?
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
?
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
?
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
?
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
?
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
?
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
?
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
?
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
?
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
?
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
?
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
?
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
?
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
?
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Philip Schwarz
?
Ad

Android - Message

  • 1. Android ¨C Message Yong Heui Cho @ Mokwon University Some of slides are referred to: [1] Nitin Ramchandani, Android OS, slideshare.
  • 3. 3 Application Lifecycle I. In Android, every application runs in their own process. II. Processes are started or stopped as needed to run application components. III. A process may be killed to reclaim resources. ¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
  • 5. 5 ? onCreate(Bundle): This is called when the activity first starts up. ?onStart( ): This indicates the activity is about to be displayed to the user. ? onResume( ): This is called when your activity can start interacting with the user. This is a good place to start animations and music. ? onPause( ): This runs when the activity is about to go into the background, usually because another activity has been launched in front of it. This is where you should save your program¡¯s persistent state, such as a database record being edited. Activity Lifecycle (II) ¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
  • 6. 6 ? onStop( ): This is called when your activity is no longer visible to the user and it won¡¯t be needed for a while. If memory is tight, onStop( ) may never be called (the system may simply terminate your process). ? onRestart( ): If this method is called, it indicates your activity is being redisplayed to the user from a stopped state. ? onDestroy( ): This is called right before your activity is destroyed. If memory is tight, onDestroy( ) may never be called (the system may simply terminate your process). Activity Lifecycle (III) ¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
  • 7. 7 ?onSaveInstanceState(Bundle): Android will call this method to allow the activity to save per-instance state, such as a cursor position within a text field. Usually you won¡¯t need to override it because the default implementation saves the state for all your user interface controls automatically. ? onRestoreInstanceState(Bundle): This is called when the activity is being reinitialized from a state previously saved by the onSaveInstanceState( ) method. The default implementation restores the state of your user interface. Save & Restore ¡õ Courtesy to Nitin Ramchandani, Android OS, slideshare.
  • 8. 8 Lifecycle Comparison Run Terminate onCreate() onDestroy() onStart() onStop() onResume() onPause() onRestart() - onRestoreInstanceState() onSaveInstanceState()
  • 10. 10 Android vs. Windows type Android Windows CPU optimal fast battery small power supply memory mobile DRAM small DRAM large message handler message (Message) or action (String) message (int) termination app lifecycle permanent function call call & proceed call & wait or call & proceed
  • 12. 12 Android Msg Handler ? Message: containing a description and arbitrary data object ? Runnable: a command that can be executed ? Handler: allows you to send and process Message and Runnable ? Looper: used to run a message loop for a thread
  • 14. 14 Android Rules ? Do not block the UI thread (or main thread). ? Do not access the Android UI toolkit from outside the UI thread.
  • 15. 15 Context ? Interface to global information about an application environment ? Uses of context ¨C Creating new objects ¨C Accessing standard common resources ¨C Accessing components implicitly Activity Context OS
  • 16. 16 Access of Context ? this ¨C Activity extends Context ? View.getContext() ¨C Context for View (usually Activity Context) ? Activity.getApplicationContext() ¨C Permanent Application Context ? ContextWrapper.getBaseContext() ¨C Access to another Context