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

Fragment
Fragment Fragment
Android Components
Android ComponentsAndroid Components
Android Components
Aatul Palandurkar
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializable
Sourabh Sahu
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Aly Abdelkareem
 
Android application-component
Android application-componentAndroid application-component
Android application-component
Ly Haza
 
Notification android
Notification androidNotification android
Notification android
ksheerod shri toshniwal
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
Jussi Pohjolainen
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
nationalmobileapps
 
04 activities and activity life cycle
04 activities and activity life cycle04 activities and activity life cycle
04 activities and activity life cycle
Sokngim Sa
 
Android UI
Android UIAndroid UI
Android UI
nationalmobileapps
 
android layouts
android layoutsandroid layouts
android layouts
Deepa Rani
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
jerry vasoya
 
Android Widget
Android WidgetAndroid Widget
Android Widget
ELLURU Kalyan
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
Sourabh Sahu
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
Prawesh Shrestha
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
vishal choudhary
 
Android notification
Android notificationAndroid notification
Android notification
Krazy Koder
 
Android SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaAndroid SDK Tutorial | Edureka
Android SDK Tutorial | Edureka
Edureka!
 
Android resource
Android resourceAndroid resource
Android resource
Krazy Koder
 
Android ui dialog
Android ui dialogAndroid ui dialog
Android ui dialog
Krazy Koder
 

What's hot (20)

Fragment
Fragment Fragment
Fragment
 
Android Components
Android ComponentsAndroid Components
Android Components
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializable
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android application-component
Android application-componentAndroid application-component
Android application-component
 
Notification android
Notification androidNotification android
Notification android
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
04 activities and activity life cycle
04 activities and activity life cycle04 activities and activity life cycle
04 activities and activity life cycle
 
Android UI
Android UIAndroid UI
Android UI
 
android layouts
android layoutsandroid layouts
android layouts
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
 
Android Widget
Android WidgetAndroid Widget
Android Widget
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
 
Android notification
Android notificationAndroid notification
Android notification
 
Android SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaAndroid SDK Tutorial | Edureka
Android SDK Tutorial | Edureka
 
Android resource
Android resourceAndroid resource
Android resource
 
Android ui dialog
Android ui dialogAndroid ui dialog
Android ui dialog
 

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 recievers
Utkarsh 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 Beginners
Jordan Silva
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
Wingston
 
Google Android
Google AndroidGoogle Android
Google Android
Michael Angelo Rivera
 
Http Caching for the Android Aficionado
Http Caching for the Android AficionadoHttp Caching for the Android Aficionado
Http Caching for the Android Aficionado
Paul Blundell
 
Android studio
Android studioAndroid studio
Android studio
Paresh Mayani
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
Suyash Srijan
 
Slideshare android
Slideshare androidSlideshare android
Slideshare android
deepakkumargoyal
 
Activity android
Activity androidActivity android
Activity android
Pierre Christophe Faye
 

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.pptx
MugiiiReee
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
PERKYTORIALS
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
Kumar
 
Android activity
Android activityAndroid activity
Android activity
MohNage7
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2
DHIRAJ 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.pptx
ShantanuDharekar
 
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
 
Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
Nikunj Dhameliya
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
ssusere71a07
 
Android - Activity, Services
Android - Activity, ServicesAndroid - Activity, Services
Android - Activity, Services
Dr Karthikeyan Periasamy
 
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
Dr. Ramkumar Lakshminarayanan
 
fragments-activity.pptx
fragments-activity.pptxfragments-activity.pptx
fragments-activity.pptx
SriKGangadharRaoAssi
 
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
 
Mad textbook 63-116
Mad textbook 63-116Mad textbook 63-116
Mad textbook 63-116
PrathishGM
 
Android
AndroidAndroid
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
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
Android activity intentsq
Android activity intentsqAndroid activity intentsq
Android activity intentsq
perpetrotech
 
Android activity intents
Android activity intentsAndroid activity intents
Android activity intents
perpetrotech
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and Events
Henry Osborne
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
Lope 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 lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
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
 
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

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

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

Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 

Recently uploaded (20)

Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 

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.