SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Android Insights - 1


       Intents
Topics to be Covered
• Basic Components of Android
• Intents & Intent Filters
• Intent Resolution




2/8/2012           Android Insights - 1   2/10
Basic Components of Android
• Activity
      – provides a screen with which users can interact in
        order to do something
• Service
      – performs long-running operations in the background
        and does not provide a user interface
• Content Provider
      – manages access to a structured set of data
• Intent
      – an abstract description of an operation to be
        performed

2/8/2012                    Android Insights - 1             3/10
Motivation Towards Intents
• We want all the activities, services, broadcast
  receivers etc. to be loosely-coupled.
• Message Passing is the way to go.
• Intents are those messages which are used to
  communicate among the components.

Remember? “An intent is an abstract description
of an operation to be performed.”
2/8/2012             Android Insights - 1       4/10
Primary Structure of an Intent
• Action
      – The general action to be performed
• Data
      – The data to operate on, expressed as a URI.

Example of an action-data pair:
ACTION_VIEW        content://contacts/people/1
Display information about the person whose identifier
is "1".

2/8/2012                  Android Insights - 1        5/10
How Intents Work
• Given an arbitrary intent we need to know what to do
  with it.
• This is handled by the process of Intent
  resolution, which maps an Intent to an
  Activity, BroadcastReceiver, or Service (or sometimes
  two or more activities/receivers) that can handle it.
• The intent resolution mechanism basically revolves
  around matching an Intent against all of the <intent-
  filter> descriptions in the installed application
  packages.
• There is a manifest file in the next slide where activities
  are marked with the intents they can operate on.

2/8/2012                  Android Insights - 1            6/10
How Intents Work...




           What are those category and data elements in intent filters??
2/8/2012              Android Insights - 1                          7/10
The Other Parts of Intent
•   Category
      – Gives additional information about the action to execute.
      – For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level
        application.
•   Type
      – Specifies an explicit type (a MIME type) of the intent data.
      – Normally the type is inferred from the data itself. By setting this attribute, you disable that
        evaluation and force an explicit type.
      – For example, setting type to image/jpeg means the activity can handle only jpeg files and not
        other image files such as png, gif etc.
•   Extras
      – A Bundle of any additional information.
      – Can be used to provide extended information to the component.
      – For example, an ACTION_HEADSET_PLUG has a "state" extra indicating whether the headset is
        now plugged in or unplugged, as well as a "name" extra for the type of headset.
•   Flags
      – Flags of various sorts.
      – For example, in the case of FLAG_ACTIVITY_NO_ANIMATION, if set in an Intent passed to
        Context.startActivity(), this flag will prevent the system from applying an activity transition
        animation to go to the next activity state.

2/8/2012                                     Android Insights - 1                                         8/10
Explicit Intents
Hey, the Intent-Resolution mechanism of Android is cool, but
I just need to start a new activity – that’s all. All those fuzz
aren’t worth of merely starting an activity, I guess???
• You’re right.
• There is a last part in an intent – Component.
• An intent can have specified a component (via
   setComponent(ComponentName) or
   setClass(Context, Class)), which provides the exact class to be
   run.
• Often these will not include any other information, simply being a
   way for an application to launch various internal activities it has as
   the user interacts with the application.
• Intents having components set are called Explicit Intents in contrast
   to their counterparts Implicit Intents.
2/8/2012                       Android Insights - 1                   9/10
References
• Intent Structure and Intent Resolution
  Mechanism:
  http://developer.android.com/guide/topics/in
  tents/intents-filters.html
• Standard actions, categories, flags and extra
  data:
  http://developer.android.com/reference/andr
  oid/content/Intent.html

2/8/2012            Android Insights - 1     10/10

Weitere ähnliche Inhalte

Ähnlich wie Android Insights - 1 [Intents]

Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 
04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)TECOS
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptBirukMarkos
 
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 Application Components
Android Application ComponentsAndroid Application Components
Android Application ComponentsJAINAM KAPADIYA
 
Kotlin for Android App Development Presentation
Kotlin for Android App Development PresentationKotlin for Android App Development Presentation
Kotlin for Android App Development PresentationKnoldus Inc.
 
Android Training (android fundamental)
Android Training (android fundamental)Android Training (android fundamental)
Android Training (android fundamental)Khaled Anaqwa
 
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkkSWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkkerenakarsu1
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentalsAmr Salman
 
Android Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intentsAndroid Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intentsDenis Minja
 
Android application model
Android application modelAndroid application model
Android application modelmagicshui
 
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
 
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
 
Yourstory Android Workshop
Yourstory Android WorkshopYourstory Android Workshop
Yourstory Android WorkshopArvind Devaraj
 

Ähnlich wie Android Insights - 1 [Intents] (20)

ANDROID
ANDROIDANDROID
ANDROID
 
Android intent
Android intentAndroid intent
Android intent
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)04 programmation mobile - android - (db, receivers, services...)
04 programmation mobile - android - (db, receivers, services...)
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).ppt
 
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 Application Components
Android Application ComponentsAndroid Application Components
Android Application Components
 
Kotlin for Android App Development Presentation
Kotlin for Android App Development PresentationKotlin for Android App Development Presentation
Kotlin for Android App Development Presentation
 
Unit - III.pptx
Unit - III.pptxUnit - III.pptx
Unit - III.pptx
 
Android Training (android fundamental)
Android Training (android fundamental)Android Training (android fundamental)
Android Training (android fundamental)
 
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkkSWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
 
Basics 4
Basics   4Basics   4
Basics 4
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentals
 
Android Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intentsAndroid Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intents
 
Android application model
Android application modelAndroid application model
Android application model
 
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
 
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
 
Android session 2
Android session 2Android session 2
Android session 2
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
 
Yourstory Android Workshop
Yourstory Android WorkshopYourstory Android Workshop
Yourstory Android Workshop
 

Mehr von Sharafat Ibn Mollah Mosharraf (7)

GRP GRM Development Progress Presentation
GRP GRM Development Progress PresentationGRP GRM Development Progress Presentation
GRP GRM Development Progress Presentation
 
Manners Matter: Learning Professional Etiquettes
Manners Matter: Learning Professional EtiquettesManners Matter: Learning Professional Etiquettes
Manners Matter: Learning Professional Etiquettes
 
SQL
SQLSQL
SQL
 
Hibernate collection & association mapping
Hibernate collection & association mappingHibernate collection & association mapping
Hibernate collection & association mapping
 
Effective Learning (& Teaching)
Effective Learning (& Teaching)Effective Learning (& Teaching)
Effective Learning (& Teaching)
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Android Insights - 3 [Content Providers]
Android Insights - 3 [Content Providers]Android Insights - 3 [Content Providers]
Android Insights - 3 [Content Providers]
 

Kürzlich hochgeladen

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 

Kürzlich hochgeladen (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Android Insights - 1 [Intents]

  • 1. Android Insights - 1 Intents
  • 2. Topics to be Covered • Basic Components of Android • Intents & Intent Filters • Intent Resolution 2/8/2012 Android Insights - 1 2/10
  • 3. Basic Components of Android • Activity – provides a screen with which users can interact in order to do something • Service – performs long-running operations in the background and does not provide a user interface • Content Provider – manages access to a structured set of data • Intent – an abstract description of an operation to be performed 2/8/2012 Android Insights - 1 3/10
  • 4. Motivation Towards Intents • We want all the activities, services, broadcast receivers etc. to be loosely-coupled. • Message Passing is the way to go. • Intents are those messages which are used to communicate among the components. Remember? “An intent is an abstract description of an operation to be performed.” 2/8/2012 Android Insights - 1 4/10
  • 5. Primary Structure of an Intent • Action – The general action to be performed • Data – The data to operate on, expressed as a URI. Example of an action-data pair: ACTION_VIEW content://contacts/people/1 Display information about the person whose identifier is "1". 2/8/2012 Android Insights - 1 5/10
  • 6. How Intents Work • Given an arbitrary intent we need to know what to do with it. • This is handled by the process of Intent resolution, which maps an Intent to an Activity, BroadcastReceiver, or Service (or sometimes two or more activities/receivers) that can handle it. • The intent resolution mechanism basically revolves around matching an Intent against all of the <intent- filter> descriptions in the installed application packages. • There is a manifest file in the next slide where activities are marked with the intents they can operate on. 2/8/2012 Android Insights - 1 6/10
  • 7. How Intents Work... What are those category and data elements in intent filters?? 2/8/2012 Android Insights - 1 7/10
  • 8. The Other Parts of Intent • Category – Gives additional information about the action to execute. – For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application. • Type – Specifies an explicit type (a MIME type) of the intent data. – Normally the type is inferred from the data itself. By setting this attribute, you disable that evaluation and force an explicit type. – For example, setting type to image/jpeg means the activity can handle only jpeg files and not other image files such as png, gif etc. • Extras – A Bundle of any additional information. – Can be used to provide extended information to the component. – For example, an ACTION_HEADSET_PLUG has a "state" extra indicating whether the headset is now plugged in or unplugged, as well as a "name" extra for the type of headset. • Flags – Flags of various sorts. – For example, in the case of FLAG_ACTIVITY_NO_ANIMATION, if set in an Intent passed to Context.startActivity(), this flag will prevent the system from applying an activity transition animation to go to the next activity state. 2/8/2012 Android Insights - 1 8/10
  • 9. Explicit Intents Hey, the Intent-Resolution mechanism of Android is cool, but I just need to start a new activity – that’s all. All those fuzz aren’t worth of merely starting an activity, I guess??? • You’re right. • There is a last part in an intent – Component. • An intent can have specified a component (via setComponent(ComponentName) or setClass(Context, Class)), which provides the exact class to be run. • Often these will not include any other information, simply being a way for an application to launch various internal activities it has as the user interacts with the application. • Intents having components set are called Explicit Intents in contrast to their counterparts Implicit Intents. 2/8/2012 Android Insights - 1 9/10
  • 10. References • Intent Structure and Intent Resolution Mechanism: http://developer.android.com/guide/topics/in tents/intents-filters.html • Standard actions, categories, flags and extra data: http://developer.android.com/reference/andr oid/content/Intent.html 2/8/2012 Android Insights - 1 10/10