SlideShare a Scribd company logo
1 of 21
Download to read offline
Android Activity
Topics
• What is an Activity?
• Declaration of Activities in manifest file
• Activities and application
• Activity life-cycle
• Activity stack
What is an Activity?
What is an Activity?
• An activity presents a visual user interface (screen)
for one focused endeavor the user can undertake.
> For example, an activity might present a list of menu
items users can choose from or it might display
photographs along with their captions.
> A text messaging application might have one activity
that shows a list of contacts to send messages to, a
second activity to write the message to the chosen
contact, and other activities to review old messages
or change settings.
Activity and Visual Content
• Visual content of the window is provided by a
hierarchy of views
• Each view controls a particular rectangular space
within the window.
> Parent views contain and organize the layout of their
children.
> Leaf views (those at the bottom of the hierarchy) draw in
the rectangles they control and respond to user actions
directed at that space.
• Views are where the activity's interaction with the
user takes place.
> For example, a view might display a small image or
button and initiate an action when the user taps that
image or button.
How Visual Content is Presented?
• Each activity is given a default window to draw
> Typically, the window fills the screen, but it might be
smaller than the screen and float on top of other
windows.
• A view hierarchy is placed within an activity's
window by the Activity.setContentView() method.
> The content view is the View object at the root of the
hierarchy.
Activities and Application
Application is Made up with Activities
• An application might consist of just one or more
Activities
> What the activities are, and how many there are
depends, of course, on the application and its design.
• Typically, one of the activities is marked as the first
one that should be presented to the user when the
application is launched.
> Specified in the AndroidManifest.xml
• Moving from one activity to another is
accomplished by having the current activity start
the next one
How an Activity Launch Another?
• An activity is launched in two ways
> startActivity(Intent intent) - Used when launching
activity (calling activity) does not expect a result
> startActivityForResult(Intent intent) - Used when
launching activity expects a result
• The responding activity can look at the initial intent
that caused it to be launched by calling its
getIntent() method
> (We have not learned Intent yet but think of Intent as
a message that gets passed around between
Activities)
Declaration of Activities in the
Manifest fileanifest file
What is Manifest File?
• Every Activity has to be declared in the Manifest
file - otherwise “Activity Not Found” error condition
occurs
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png"
android:label="@string/freneticLabel"
. . . >
</activity>
. . .
</application>
</manifest>
Activity Lifecyclectivity Li
An Activity has three states
• 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.
• Paused
> If it has lost focus but is still visible to the user.
> That is, another activity lies on top of it and that
activity either is transparent or doesn't cover the full
screen, so some of the paused activity can show
through.
> A paused activity is completely alive (it maintains all
state and member information and remains attached
to the window manager), but can be killed by the
system in extreme low memory situations.
An Activity has three states
• 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.
State Transition Callback Methods
• As an activity transitions from state to state, it is
notified of the change by calls to the following
protected methods:
> void onCreate(Bundle savedInstanceState)
> void onStart()
> void onRestart()
> void onResume()
> void onPause()
> void onStop()
> void onDestroy()
• All activities must implement onCreate() to do the
initial setup when the object is first instantiated
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().
Lifecycle Lifetime
• Entire lifetime
> Between the first call to onCreate() through to a
single final call to onDestroy().
• Visible lifetime
> Between a call to onStart() until a corresponding call
to onStop()
• Foreground lifetime
> Between a call to onResume() until a corresponding
call to onPause()
• The square rectangles
represent callback
methods you can
implement to perform
operations when the
Activity moves
between states.
• The colored ovals are
major states the
Activity can be in.
Activity Stackctivity Sta
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.
Thank you

More Related Content

What's hot

Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycleSoham Patel
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONAYESHA JAVED
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & viewsma-polimi
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle瑋琮 林
 
Android animation
Android animationAndroid animation
Android animationKrazy Koder
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development pptGautam Kumar
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologiesjerry vasoya
 
Supporting multiple screens on android
Supporting multiple screens on androidSupporting multiple screens on android
Supporting multiple screens on androidLi SUN
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecturedeepakshare
 

What's hot (20)

Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATION
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
AndroidManifest
AndroidManifestAndroidManifest
AndroidManifest
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android life cycle
Android life cycleAndroid life cycle
Android life cycle
 
Android Services
Android ServicesAndroid Services
Android Services
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Android animation
Android animationAndroid animation
Android animation
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development ppt
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Supporting multiple screens on android
Supporting multiple screens on androidSupporting multiple screens on android
Supporting multiple screens on android
 
Activity lifecycle
Activity lifecycleActivity lifecycle
Activity lifecycle
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Broadcast receivers
Broadcast receiversBroadcast receivers
Broadcast receivers
 
Google android Activity lifecycle
Google android Activity lifecycle Google android Activity lifecycle
Google android Activity lifecycle
 

Viewers also liked

Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Class 02 - Android Study Jams: Android Development for Beginners
Class 02 - Android Study Jams: Android Development for BeginnersClass 02 - Android Study Jams: Android Development for Beginners
Class 02 - Android Study Jams: Android Development for BeginnersJordan Silva
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - AndroidWingston
 
Http Caching for the Android Aficionado
Http Caching for the Android AficionadoHttp Caching for the Android Aficionado
Http Caching for the Android AficionadoPaul Blundell
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android StudioSuyash Srijan
 

Viewers also liked (9)

Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Class 02 - Android Study Jams: Android Development for Beginners
Class 02 - Android Study Jams: Android Development for BeginnersClass 02 - Android Study Jams: Android Development for Beginners
Class 02 - Android Study Jams: Android Development for Beginners
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
 
Google Android
Google AndroidGoogle Android
Google Android
 
Http Caching for the Android Aficionado
Http Caching for the Android AficionadoHttp Caching for the Android Aficionado
Http Caching for the Android Aficionado
 
Android studio
Android studioAndroid studio
Android studio
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Slideshare android
Slideshare androidSlideshare android
Slideshare android
 
Activity android
Activity androidActivity android
Activity android
 

Similar to Android activity

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
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intentPERKYTORIALS
 
Android activity
Android activityAndroid activity
Android activityMohNage7
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2DHIRAJ PRAVIN
 
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
 
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
 
Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android applicationNikunj Dhameliya
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdfssusere71a07
 
Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Dr. Ramkumar Lakshminarayanan
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database faiz324545
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestateOsahon Gino Ediagbonya
 
Mad textbook 63-116
Mad textbook 63-116Mad textbook 63-116
Mad textbook 63-116PrathishGM
 
Android activity intentsq
Android activity intentsqAndroid activity intentsq
Android activity intentsqperpetrotech
 
Android activity intents
Android activity intentsAndroid activity intents
Android activity intentsperpetrotech
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and EventsHenry Osborne
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & IntentsLope Emano
 

Similar to Android activity (20)

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
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
Android activity
Android activityAndroid activity
Android activity
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2
 
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
 
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
 
Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
 
Android - Activity, Services
Android - Activity, ServicesAndroid - Activity, Services
Android - Activity, Services
 
Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3Android building blocks and application life cycle-chapter3
Android building blocks and application life cycle-chapter3
 
fragments-activity.pptx
fragments-activity.pptxfragments-activity.pptx
fragments-activity.pptx
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Mad textbook 63-116
Mad textbook 63-116Mad textbook 63-116
Mad textbook 63-116
 
Android
AndroidAndroid
Android
 
Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS
 
Android activity intentsq
Android activity intentsqAndroid activity intentsq
Android activity intentsq
 
Android activity intents
Android activity intentsAndroid activity intents
Android activity intents
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and Events
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
 

More from Krazy Koder (20)

2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xc
2310 b xc2310 b xc
2310 b xc
 
2310 b xb
2310 b xb2310 b xb
2310 b xb
 
2310 b 17
2310 b 172310 b 17
2310 b 17
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 14
2310 b 142310 b 14
2310 b 14
 
2310 b 13
2310 b 132310 b 13
2310 b 13
 
2310 b 12
2310 b 122310 b 12
2310 b 12
 
2310 b 11
2310 b 112310 b 11
2310 b 11
 
2310 b 10
2310 b 102310 b 10
2310 b 10
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 07
2310 b 072310 b 07
2310 b 07
 

Recently uploaded

Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryCeline George
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45MysoreMuleSoftMeetup
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Celine George
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...Krashi Coaching
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatmentsaipooja36
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Sumit Tiwari
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Mohamed Rizk Khodair
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfAlexander Litvinenko
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
Poster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdfPoster_density_driven_with_fracture_MLMC.pdf
Poster_density_driven_with_fracture_MLMC.pdf
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 

Android activity

  • 2. Topics • What is an Activity? • Declaration of Activities in manifest file • Activities and application • Activity life-cycle • Activity stack
  • 3. What is an Activity?
  • 4. What is an Activity? • An activity presents a visual user interface (screen) for one focused endeavor the user can undertake. > For example, an activity might present a list of menu items users can choose from or it might display photographs along with their captions. > A text messaging application might have one activity that shows a list of contacts to send messages to, a second activity to write the message to the chosen contact, and other activities to review old messages or change settings.
  • 5. Activity and Visual Content • Visual content of the window is provided by a hierarchy of views • Each view controls a particular rectangular space within the window. > Parent views contain and organize the layout of their children. > Leaf views (those at the bottom of the hierarchy) draw in the rectangles they control and respond to user actions directed at that space. • Views are where the activity's interaction with the user takes place. > For example, a view might display a small image or button and initiate an action when the user taps that image or button.
  • 6. How Visual Content is Presented? • Each activity is given a default window to draw > Typically, the window fills the screen, but it might be smaller than the screen and float on top of other windows. • A view hierarchy is placed within an activity's window by the Activity.setContentView() method. > The content view is the View object at the root of the hierarchy.
  • 8. Application is Made up with Activities • An application might consist of just one or more Activities > What the activities are, and how many there are depends, of course, on the application and its design. • Typically, one of the activities is marked as the first one that should be presented to the user when the application is launched. > Specified in the AndroidManifest.xml • Moving from one activity to another is accomplished by having the current activity start the next one
  • 9. How an Activity Launch Another? • An activity is launched in two ways > startActivity(Intent intent) - Used when launching activity (calling activity) does not expect a result > startActivityForResult(Intent intent) - Used when launching activity expects a result • The responding activity can look at the initial intent that caused it to be launched by calling its getIntent() method > (We have not learned Intent yet but think of Intent as a message that gets passed around between Activities)
  • 10. Declaration of Activities in the Manifest fileanifest file
  • 11. What is Manifest File? • Every Activity has to be declared in the Manifest file - otherwise “Activity Not Found” error condition occurs <?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticLabel" . . . > </activity> . . . </application> </manifest>
  • 13. An Activity has three states • 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. • Paused > If it has lost focus but is still visible to the user. > That is, another activity lies on top of it and that activity either is transparent or doesn't cover the full screen, so some of the paused activity can show through. > A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.
  • 14. An Activity has three states • 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.
  • 15. State Transition Callback Methods • As an activity transitions from state to state, it is notified of the change by calls to the following protected methods: > void onCreate(Bundle savedInstanceState) > void onStart() > void onRestart() > void onResume() > void onPause() > void onStop() > void onDestroy() • All activities must implement onCreate() to do the initial setup when the object is first instantiated
  • 16. 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().
  • 17. Lifecycle Lifetime • Entire lifetime > Between the first call to onCreate() through to a single final call to onDestroy(). • Visible lifetime > Between a call to onStart() until a corresponding call to onStop() • Foreground lifetime > Between a call to onResume() until a corresponding call to onPause()
  • 18. • The square rectangles represent callback methods you can implement to perform operations when the Activity moves between states. • The colored ovals are major states the Activity can be in.
  • 20. 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.