SlideShare a Scribd company logo
Android –
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
– Creating new objects
– Accessing standard common resources
– Accessing components implicitly
Activity
Context
OS
16
Access of Context
• this
– Activity extends Context
• View.getContext()
– Context for View (usually Activity Context)
• Activity.getApplicationContext()
– Permanent Application Context
• ContextWrapper.getBaseContext()
– Access to another Context

More Related Content

PPTX
Zk meetup talk
PPTX
Android - Message
ODP
Anatomy of android application
PPTX
Presentation on Android application life cycle and saved instancestate
PPT
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
PPTX
Lecture #4 activities & fragments
PPT
Android lifecycle
Zk meetup talk
Android - Message
Anatomy of android application
Presentation on Android application life cycle and saved instancestate
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
Lecture #4 activities & fragments
Android lifecycle

Similar to Android - Message (20)

PPTX
Dori waldman android _course
PPTX
Dori waldman android _course_2
ODT
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...
PPT
Unit I- ANDROID OVERVIEW.ppt
PDF
Android development Training Programme Day 2
PPTX
Android - Sensor Manager
PPTX
[충격] 당신의 안드로이드 앱이 느린 이유가 있다??!
PPTX
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
PPTX
Process Management in Android
PPTX
02. Android application development_Lec2.pptx
PDF
Android Best Practices - Thoughts from the Trenches
PDF
Android life cycle
PPTX
Unit-1.2 Android-Activities, Fragments, and Intents (1).pptx
PPTX
Threads handlers and async task, widgets - day8
PPTX
Android Architecture v2 presetnation extension
PPT
MD-IV-CH-ppt.ppt
PDF
Android_Architectuture pdf complete detail
PPTX
04 activities and activity life cycle
PDF
Android activity
PDF
Android activity
Dori waldman android _course
Dori waldman android _course_2
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...
Unit I- ANDROID OVERVIEW.ppt
Android development Training Programme Day 2
Android - Sensor Manager
[충격] 당신의 안드로이드 앱이 느린 이유가 있다??!
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
Process Management in Android
02. Android application development_Lec2.pptx
Android Best Practices - Thoughts from the Trenches
Android life cycle
Unit-1.2 Android-Activities, Fragments, and Intents (1).pptx
Threads handlers and async task, widgets - day8
Android Architecture v2 presetnation extension
MD-IV-CH-ppt.ppt
Android_Architectuture pdf complete detail
04 activities and activity life cycle
Android activity
Android activity
Ad

More from Yong Heui Cho (20)

PPTX
Android - Sensor Manager
PPTX
Android - Broadcast Receiver
PPTX
Cloud Computing
PPTX
Computing Paradigm
DOCX
TestBCD2018-2(answer)
DOCX
TestSDS2018-2(answer)
DOCX
TestEC2018-2(answer)
DOCX
TestEC2018-1(answer)
DOCX
TestBCD2018-1(answer)
DOCX
TestSDS2018-1(answer)
PPTX
BJT - Analysis of Bias
DOCX
TestCloud2018-2(answer)
DOCX
TestECD2018-1(answer)
DOCX
Test-SDIC2018-2(answer)
DOCX
TestCloud2018-1(answer)
PPTX
Cloud Service Model
DOCX
Test-SDIC2018-1(Answer)
DOCX
RF 증폭기 설계(Design of RF Amplifier)-rev1
PPTX
Computing Paradigm - rev1
PPTX
Cloud Deployment Model
Android - Sensor Manager
Android - Broadcast Receiver
Cloud Computing
Computing Paradigm
TestBCD2018-2(answer)
TestSDS2018-2(answer)
TestEC2018-2(answer)
TestEC2018-1(answer)
TestBCD2018-1(answer)
TestSDS2018-1(answer)
BJT - Analysis of Bias
TestCloud2018-2(answer)
TestECD2018-1(answer)
Test-SDIC2018-2(answer)
TestCloud2018-1(answer)
Cloud Service Model
Test-SDIC2018-1(Answer)
RF 증폭기 설계(Design of RF Amplifier)-rev1
Computing Paradigm - rev1
Cloud Deployment Model
Ad

Recently uploaded (20)

PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Introduction to Artificial Intelligence
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
System and Network Administration Chapter 2
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
L1 - Introduction to python Backend.pptx
PDF
AI in Product Development-omnex systems
PDF
System and Network Administraation Chapter 3
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Wondershare Filmora 15 Crack With Activation Key [2025
Upgrade and Innovation Strategies for SAP ERP Customers
Operating system designcfffgfgggggggvggggggggg
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction to Artificial Intelligence
Odoo Companies in India – Driving Business Transformation.pdf
Odoo POS Development Services by CandidRoot Solutions
CHAPTER 2 - PM Management and IT Context
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Softaken Excel to vCard Converter Software.pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
System and Network Administration Chapter 2
Online Work Permit System for Fast Permit Processing
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
L1 - Introduction to python Backend.pptx
AI in Product Development-omnex systems
System and Network Administraation Chapter 3
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025

Android - Message

  • 1. Android – 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 – Creating new objects – Accessing standard common resources – Accessing components implicitly Activity Context OS
  • 16. 16 Access of Context • this – Activity extends Context • View.getContext() – Context for View (usually Activity Context) • Activity.getApplicationContext() – Permanent Application Context • ContextWrapper.getBaseContext() – Access to another Context