SlideShare a Scribd company logo
Welcome

Every Day is a new Beginning
Major Application components
Any Android application must have at least one amongst the following
components:
•

Activity

•

Intent & Intent Filters

•

Broadcast Receivers

•

Services

•

Content Providers
Activity
•Activity is an application component which provides User Interface(UI) to any
application

•An application can have any number of activities but only one of them can have the
focus at any given time of the application’s visible lifetime
•All other activities are moved to a “back-stack” which uses First In First Out (FIFO)
mechanism to handle those activities
•All activities have a set of methods known as “Callback methods”, which will get
triggered during different stages of an Activity lifecycle
•Views control rectangular space within an activity & interacts with the user

•Widgets = Views + Visual elements + business logic
•Layouts are special type of Views, which are derived from ViewGroup group
Activity Lifecycle
Activity – Callback methods
• onCreate() – triggered when the Activity is created

• onStart() – triggered when the Activity is started
• onResume() – triggered when the Activity is resumed after pause
• onPause() – triggered when the Activity is paused
• onStop() – triggered when the Activity goes out to background stack
• onDestroy() – triggered when the Activity is destroyed
States of an Activity

An activity can be in anyone of the states in its entire lifecycle:
• Resumed – Activity is in running
• Paused – Activity is paused & visible in the background
• Stopped – Activity is paused & not visible in the background ( in backstack)
Start & Stop an Activity
• An activity can be started in two ways :
•
•

Using startActivity(Intent intent) method
Using startActivityForResult(int reqCode,int resCode, Intent data) method

• The first method is used to start an activity normally
• The second method is used to start an activity when a specific resultant
action is expected. Eg. Choose a phone contact from Contacts application
• If an activity is started using second method, the control will be passed to
this method after the expected result – onActivityResult()
• An activity can be stopped/killed in ways:
•
•

Using finishActivity() method (Recommended)
Using finish() method
How to start an Activity
• An activity can be started from another activity using another application
component called Intent.
• A java class with name Sample.java, which extends Activity class must be
created.
• An entry in AndroidManifest.xml file should be included
• A layout XML file must be created and proper layout should be created in
XML file
• Code snipped to start an activity (using its name):
Intent intent = new Intent(this, Sample.class);
startActivity(intent);
How to start an Activity
• An activity can also be started without explicitly stating its name but the
action that it can perform
Steps:
• A java class with name Sample.java, which extends Activity class must be
created.
• An entry in AndroidManifest.xml file is included & an action is defined in
Intent_Filter tag
• A layout XML file is created and proper layout is created in XML file
• Code snipped to start an activity (using its name):
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, recipientArray);
startActivity(intent);
Intents
•

Application components are activated through messages called Intents

•

Intents provide a facility for late runtime binding between components of
same application or different applications as well

•

Basically, it is a passive data structure, which holds an abstract definition of an
action performed or to be taken

•

It is used to start Activities using “startActivity(intent)” method

•

It is also used to start or bind Services using “startService(intent)” and
“bindService(intent)” methods

•

It is also used to send broadcasts using “sendStickyBroadcast(intent)” methods
Intent Objects
Every Intent contains at least one of the following objects:
1.

Component Name [optional] – Component with Intent is associated

2.

Action (mandatory)

3.

Category (mandatory at least once) – Category of Action

4.

Data [optional & depends on type of Action] – URI & MIME type of data
needed to complete Action

5.

Extras [optional] – Data needed to complete Action

6.

Flags [optional] – Eg. Which task the activity should belong to ?
Intent Types
Intents can be classified into following two types:
•

Explicit Intents – Associated component name is explicitly mentioned
Intent intent1 = new Intent(this,ActivityTwo.class);
startActivity(intent);

•

Implicit Intents – Associated component name is implied (not mentioned)
Intent intent = new Intent(Intent.ACTION_SEND);

intent.putExtra(Intent.EXTRA_EMAIL, recipientArray);
startActivity(intent);
Intent Types & Resolution
Intent Resolution :
• Intents are resolved after undergoing three tests by Intent Filter
• Intent Filter filters the suitable components based on the expected action
and other input data

1.
2.
3.

Intent Filter performs the tests in the following order and finally resolves
the component(s) associated with the Intent
Action Test
Data Test
Category Test

• Those components which pass the Action Test will be subjected to Data
Test & those which pass the Action Test will be subjected to Category Test
Thank You

Facebook.com/PerpetroTech

Office Address
New No 30/1
Velachery Road, Little Mount
Saidapet, Chennai-15

Website: www.perpetrotech.com
Mail: info@perpetrotech.com
Ph: +91- 8939707287

More Related Content

Viewers also liked

Business and Management Functions
Business and Management FunctionsBusiness and Management Functions
Business and Management Functions
Mrs Aissa Rim
 
Cranberries Nutraceutical Prospective
Cranberries Nutraceutical Prospective Cranberries Nutraceutical Prospective
Cranberries Nutraceutical Prospective
Mrs Aissa Rim
 
Microbiology Antibiotics
Microbiology AntibioticsMicrobiology Antibiotics
Microbiology Antibiotics
Mrs Aissa Rim
 
Group Presentation Skills
Group Presentation SkillsGroup Presentation Skills
Group Presentation Skills
Mrs Aissa Rim
 
Selling skills
Selling skillsSelling skills
Selling skills
Mrs Aissa Rim
 
Manager, Supervisor (Boss) Aim
Manager, Supervisor (Boss) AimManager, Supervisor (Boss) Aim
Manager, Supervisor (Boss) Aim
Mrs Aissa Rim
 
Product positioning
Product positioningProduct positioning
Product positioning
Mrs Aissa Rim
 
PAIN & PAIN MANAGEMENT
PAIN & PAIN MANAGEMENTPAIN & PAIN MANAGEMENT
PAIN & PAIN MANAGEMENT
Mrs Aissa Rim
 
Types of manager
Types of managerTypes of manager
Types of manager
Mrs Aissa Rim
 
Praising and Reprimand
Praising and ReprimandPraising and Reprimand
Praising and Reprimand
Mrs Aissa Rim
 
TIME & TERRITORY MANAGEMENT
TIME & TERRITORY MANAGEMENTTIME & TERRITORY MANAGEMENT
TIME & TERRITORY MANAGEMENT
Mrs Aissa Rim
 
Lactulose The physiological bowel and stool regulator
Lactulose The physiological bowel and stool regulatorLactulose The physiological bowel and stool regulator
Lactulose The physiological bowel and stool regulator
Mrs Aissa Rim
 
Insulin Resistance A Challenge In Diabetes Management
Insulin Resistance  A Challenge  In Diabetes ManagementInsulin Resistance  A Challenge  In Diabetes Management
Insulin Resistance A Challenge In Diabetes Management
Mrs Aissa Rim
 
Product management
Product managementProduct management
Product management
Mrs Aissa Rim
 
Managerial Functions
Managerial FunctionsManagerial Functions
Managerial Functions
Mrs Aissa Rim
 
Organization culture
Organization cultureOrganization culture
Organization culture
Mrs Aissa Rim
 
Hospital CSSD
Hospital CSSD Hospital CSSD
Hospital CSSD
Mrs Aissa Rim
 

Viewers also liked (17)

Business and Management Functions
Business and Management FunctionsBusiness and Management Functions
Business and Management Functions
 
Cranberries Nutraceutical Prospective
Cranberries Nutraceutical Prospective Cranberries Nutraceutical Prospective
Cranberries Nutraceutical Prospective
 
Microbiology Antibiotics
Microbiology AntibioticsMicrobiology Antibiotics
Microbiology Antibiotics
 
Group Presentation Skills
Group Presentation SkillsGroup Presentation Skills
Group Presentation Skills
 
Selling skills
Selling skillsSelling skills
Selling skills
 
Manager, Supervisor (Boss) Aim
Manager, Supervisor (Boss) AimManager, Supervisor (Boss) Aim
Manager, Supervisor (Boss) Aim
 
Product positioning
Product positioningProduct positioning
Product positioning
 
PAIN & PAIN MANAGEMENT
PAIN & PAIN MANAGEMENTPAIN & PAIN MANAGEMENT
PAIN & PAIN MANAGEMENT
 
Types of manager
Types of managerTypes of manager
Types of manager
 
Praising and Reprimand
Praising and ReprimandPraising and Reprimand
Praising and Reprimand
 
TIME & TERRITORY MANAGEMENT
TIME & TERRITORY MANAGEMENTTIME & TERRITORY MANAGEMENT
TIME & TERRITORY MANAGEMENT
 
Lactulose The physiological bowel and stool regulator
Lactulose The physiological bowel and stool regulatorLactulose The physiological bowel and stool regulator
Lactulose The physiological bowel and stool regulator
 
Insulin Resistance A Challenge In Diabetes Management
Insulin Resistance  A Challenge  In Diabetes ManagementInsulin Resistance  A Challenge  In Diabetes Management
Insulin Resistance A Challenge In Diabetes Management
 
Product management
Product managementProduct management
Product management
 
Managerial Functions
Managerial FunctionsManagerial Functions
Managerial Functions
 
Organization culture
Organization cultureOrganization culture
Organization culture
 
Hospital CSSD
Hospital CSSD Hospital CSSD
Hospital CSSD
 

Similar to Android activity intentsq

Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
Muhammad Sajid
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
PERKYTORIALS
 
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
 
Basics 4
Basics   4Basics   4
Basics 4
Michael Shrove
 
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
 
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
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
ssusere71a07
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).ppt
BirukMarkos
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
sunilsoni446112
 
Android activity
Android activityAndroid activity
Android activity
Krazy Koder
 
Android intent
Android intentAndroid intent
Android intent
Krazy Koder
 
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
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Owain Lewis
 
ANDROID
ANDROIDANDROID
ANDROID
DrMeftahZouai
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
Kumar
 
Android - Intents - Mazenet Solution
Android - Intents - Mazenet SolutionAndroid - Intents - Mazenet Solution
Android - Intents - Mazenet Solution
Mazenetsolution
 
Android App Development - 02 Activity and intent
Android App Development - 02 Activity and intentAndroid App Development - 02 Activity and intent
Android App Development - 02 Activity and intent
Diego Grancini
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
Muhammad Sajid
 
Android - Activity, Services
Android - Activity, ServicesAndroid - Activity, Services
Android - Activity, Services
Dr Karthikeyan Periasamy
 
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
Osahon Gino Ediagbonya
 

Similar to Android activity intentsq (20)

Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
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
 
Basics 4
Basics   4Basics   4
Basics 4
 
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
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database
 
Android Activities.pdf
Android Activities.pdfAndroid Activities.pdf
Android Activities.pdf
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).ppt
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
 
Android activity
Android activityAndroid activity
Android activity
 
Android intent
Android intentAndroid intent
Android intent
 
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
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
ANDROID
ANDROIDANDROID
ANDROID
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
Android - Intents - Mazenet Solution
Android - Intents - Mazenet SolutionAndroid - Intents - Mazenet Solution
Android - Intents - Mazenet Solution
 
Android App Development - 02 Activity and intent
Android App Development - 02 Activity and intentAndroid App Development - 02 Activity and intent
Android App Development - 02 Activity and intent
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
Android - Activity, Services
Android - Activity, ServicesAndroid - Activity, Services
Android - Activity, Services
 
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
 

Recently uploaded

Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Jeffrey Haguewood
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 

Recently uploaded (20)

Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 

Android activity intentsq

  • 1. Welcome Every Day is a new Beginning
  • 2. Major Application components Any Android application must have at least one amongst the following components: • Activity • Intent & Intent Filters • Broadcast Receivers • Services • Content Providers
  • 3. Activity •Activity is an application component which provides User Interface(UI) to any application •An application can have any number of activities but only one of them can have the focus at any given time of the application’s visible lifetime •All other activities are moved to a “back-stack” which uses First In First Out (FIFO) mechanism to handle those activities •All activities have a set of methods known as “Callback methods”, which will get triggered during different stages of an Activity lifecycle •Views control rectangular space within an activity & interacts with the user •Widgets = Views + Visual elements + business logic •Layouts are special type of Views, which are derived from ViewGroup group
  • 5. Activity – Callback methods • onCreate() – triggered when the Activity is created • onStart() – triggered when the Activity is started • onResume() – triggered when the Activity is resumed after pause • onPause() – triggered when the Activity is paused • onStop() – triggered when the Activity goes out to background stack • onDestroy() – triggered when the Activity is destroyed
  • 6. States of an Activity An activity can be in anyone of the states in its entire lifecycle: • Resumed – Activity is in running • Paused – Activity is paused & visible in the background • Stopped – Activity is paused & not visible in the background ( in backstack)
  • 7. Start & Stop an Activity • An activity can be started in two ways : • • Using startActivity(Intent intent) method Using startActivityForResult(int reqCode,int resCode, Intent data) method • The first method is used to start an activity normally • The second method is used to start an activity when a specific resultant action is expected. Eg. Choose a phone contact from Contacts application • If an activity is started using second method, the control will be passed to this method after the expected result – onActivityResult() • An activity can be stopped/killed in ways: • • Using finishActivity() method (Recommended) Using finish() method
  • 8. How to start an Activity • An activity can be started from another activity using another application component called Intent. • A java class with name Sample.java, which extends Activity class must be created. • An entry in AndroidManifest.xml file should be included • A layout XML file must be created and proper layout should be created in XML file • Code snipped to start an activity (using its name): Intent intent = new Intent(this, Sample.class); startActivity(intent);
  • 9. How to start an Activity • An activity can also be started without explicitly stating its name but the action that it can perform Steps: • A java class with name Sample.java, which extends Activity class must be created. • An entry in AndroidManifest.xml file is included & an action is defined in Intent_Filter tag • A layout XML file is created and proper layout is created in XML file • Code snipped to start an activity (using its name): Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, recipientArray); startActivity(intent);
  • 10. Intents • Application components are activated through messages called Intents • Intents provide a facility for late runtime binding between components of same application or different applications as well • Basically, it is a passive data structure, which holds an abstract definition of an action performed or to be taken • It is used to start Activities using “startActivity(intent)” method • It is also used to start or bind Services using “startService(intent)” and “bindService(intent)” methods • It is also used to send broadcasts using “sendStickyBroadcast(intent)” methods
  • 11. Intent Objects Every Intent contains at least one of the following objects: 1. Component Name [optional] – Component with Intent is associated 2. Action (mandatory) 3. Category (mandatory at least once) – Category of Action 4. Data [optional & depends on type of Action] – URI & MIME type of data needed to complete Action 5. Extras [optional] – Data needed to complete Action 6. Flags [optional] – Eg. Which task the activity should belong to ?
  • 12. Intent Types Intents can be classified into following two types: • Explicit Intents – Associated component name is explicitly mentioned Intent intent1 = new Intent(this,ActivityTwo.class); startActivity(intent); • Implicit Intents – Associated component name is implied (not mentioned) Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, recipientArray); startActivity(intent);
  • 13. Intent Types & Resolution Intent Resolution : • Intents are resolved after undergoing three tests by Intent Filter • Intent Filter filters the suitable components based on the expected action and other input data 1. 2. 3. Intent Filter performs the tests in the following order and finally resolves the component(s) associated with the Intent Action Test Data Test Category Test • Those components which pass the Action Test will be subjected to Data Test & those which pass the Action Test will be subjected to Category Test
  • 14. Thank You Facebook.com/PerpetroTech Office Address New No 30/1 Velachery Road, Little Mount Saidapet, Chennai-15 Website: www.perpetrotech.com Mail: info@perpetrotech.com Ph: +91- 8939707287