SlideShare a Scribd company logo


An intent is an abstract description of an operation to be
performed.



It can be used with startActivity to launch an Activity.
An Intent provides a facility for performing late runtime
binding between the code in different applications.





Its most significant use is in the launching of activities,
where it can be thought of as the glue between
activities.



It is basically a passive data structure holding an abstract
description of an action to be performed.


The primary pieces of information in an intent are:
◦ action -- The general action to be performed, such
as ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, etc.

◦ data -- The data to operate on, such as a person record in
the contacts database, expressed as a Uri.


There are two primary forms of intents you will use.



Explicit Intents have specified a component
(via setComponent(ComponentName) or setClass(Con
text, 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.


Implicit Intents have not specified a component;



Instead, they must include enough information for
the system to determine which of the available
components is best to run for that intent.


Predefined actions (http://developer.android.com/reference/android/content/Intent.html)
Action Name

Description

ACTION_CALL

Initiate a phone call

ACTION_EDIT

Display data to edit

ACTION_MAIN

ACTION_VIEW

Start as a main entry point, does not expect to
receive data.
Pick an item from the data, returning what was
selected.
Display the data to the user

ACTION_SEARCH

Perform a search

ACTION_PICK



Defined by the programmer

6
Intent i = new
Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://www.google.com"));
startActivity(i);

Action to perform

Data to perform the action on

 Implicit intents are very useful to re-use code and to launch external
applications …
 M re tha n a Co m p o ne nt c a n m a tc h the I nt re q ue s t …
o
nte
 How to define the target component?

7


In order to access external components in
android, permissions needs to be set in Android
Manifest file.


Example on Explicit Intents
 Explicit Intent: Specify the activity that will
handle the intent.
 The following shows how to move from First
activity to second activity.
Intent a =new Intent(FirstActivity.this, SecondActivity.class);
startActivity(a);
OR
Intent about=new Intent(getApplicationContext(),About.class);
startActivity(about);

12


Developers mostly create applications using
different activities.



These activities needs to communicate and pass
data from one part to the other.



For this case, Explicit Intents should be used.


For activities to be able to communicate to one
another.



They must be registered in the manifest file.



This is done by adding all your activities in the
manifest file.



This is done inside the <application> tag of the
manifest


Labs – Joining Activities
Creating an Options Menu
 The options menu is where you should include
actions and other options that are relevant to the
current activity context.


◦ Such as "Search“,”Save” "Compose email," and
"Settings.“
◦ Ref:


http://www.droidnova.com/how-to-create-an-option-menu,427.html


First we have to make a new folder in our
res/layout directory .



In this new directory we will create a new xml file
named menu.xml.



Put the following code.


The content of the xml file should be very self
explaining.



We have an id for each item, so we have a
reference for it.



The title attribute, if defined, is nothing more than
the text you see in the option menu.


The same with the icon attribute which references
to an icon, in our case the default icon.



Now we have to modify our Activity class.



First we have to override the method
onCreateOptionsMenu()
 menu inflator loads the menu.xml file to set the menu


Right now we can start our application and we will
see our 3 option items in our menu when we press
the menu button.



As long as nothing happens when we press one
item, the menu is senseless.



To implement a reaction of our menu, we should
override another method named
onOptionsItemSelected().
Android Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intents

More Related Content

What's hot

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
 
Part24 filter using string or char search in vb.net
Part24 filter using string or char search in vb.netPart24 filter using string or char search in vb.net
Part24 filter using string or char search in vb.net
Girija Muscut
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in android
Oum Saokosal
 
Android intents in android application-chapter7
Android intents in android application-chapter7Android intents in android application-chapter7
Android intents in android application-chapter7
Dr. Ramkumar Lakshminarayanan
 
Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptx
vishal choudhary
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
vishal choudhary
 
Lab 5-Android
Lab 5-AndroidLab 5-Android
Lab 5-Android
Lilia Sfaxi
 
Part23 parameter query using multiple record vb.net
Part23 parameter query using multiple record vb.netPart23 parameter query using multiple record vb.net
Part23 parameter query using multiple record vb.net
Girija Muscut
 
Android Trainning Session 2
Android Trainning  Session 2Android Trainning  Session 2
Android Trainning Session 2
Shanmugapriya D
 
Part 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netPart 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.net
Girija Muscut
 
07 intent
07 intent07 intent
Salesforce Einstein.pptx
Salesforce Einstein.pptxSalesforce Einstein.pptx
Salesforce Einstein.pptx
AbhinavKumar663289
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.net
Girija Muscut
 
Thinking in react
Thinking in reactThinking in react
Thinking in react
aashimadudeja
 
Lab3-Android
Lab3-AndroidLab3-Android
Lab3-Android
Lilia Sfaxi
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)
Khaled Anaqwa
 
05 objective-c session 5
05  objective-c session 505  objective-c session 5
05 objective-c session 5
Amr Elghadban (AmrAngry)
 

What's hot (19)

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
 
Part24 filter using string or char search in vb.net
Part24 filter using string or char search in vb.netPart24 filter using string or char search in vb.net
Part24 filter using string or char search in vb.net
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in android
 
Android intents in android application-chapter7
Android intents in android application-chapter7Android intents in android application-chapter7
Android intents in android application-chapter7
 
2
22
2
 
Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptx
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
 
Lab 5-Android
Lab 5-AndroidLab 5-Android
Lab 5-Android
 
Part23 parameter query using multiple record vb.net
Part23 parameter query using multiple record vb.netPart23 parameter query using multiple record vb.net
Part23 parameter query using multiple record vb.net
 
Android Trainning Session 2
Android Trainning  Session 2Android Trainning  Session 2
Android Trainning Session 2
 
Part 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.netPart 8 add,update,delete records using records operation buttons in vb.net
Part 8 add,update,delete records using records operation buttons in vb.net
 
Android search
Android searchAndroid search
Android search
 
07 intent
07 intent07 intent
07 intent
 
Salesforce Einstein.pptx
Salesforce Einstein.pptxSalesforce Einstein.pptx
Salesforce Einstein.pptx
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.net
 
Thinking in react
Thinking in reactThinking in react
Thinking in react
 
Lab3-Android
Lab3-AndroidLab3-Android
Lab3-Android
 
Android Training (Content Provider)
Android Training (Content Provider)Android Training (Content Provider)
Android Training (Content Provider)
 
05 objective-c session 5
05  objective-c session 505  objective-c session 5
05 objective-c session 5
 

Similar to Android Bootcamp Tanzania:intents

Lab1-android
Lab1-androidLab1-android
Lab1-android
Lilia Sfaxi
 
ANDROID
ANDROIDANDROID
ANDROID
DrMeftahZouai
 
Intent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).pptIntent, Service and BroadcastReciver (2).ppt
Intent, Service and BroadcastReciver (2).ppt
BirukMarkos
 
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_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
 
Android application model
Android application modelAndroid application model
Android application modelmagicshui
 
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkkSWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
erenakarsu1
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2DHIRAJ PRAVIN
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
sunilsoni446112
 
Activity & Shared Preference
Activity & Shared PreferenceActivity & Shared Preference
Activity & Shared Preference
nationalmobileapps
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)
Oum Saokosal
 
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
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
AbdullahMunir32
 
Android Insights - 1 [Intents]
Android Insights - 1 [Intents]Android Insights - 1 [Intents]
Android Insights - 1 [Intents]
Sharafat Ibn Mollah Mosharraf
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
Chandrakant Divate
 
android activity
android activityandroid activity
android activityDeepa Rani
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
Lope Emano
 
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 App To Display Employee Details
Android App To Display Employee DetailsAndroid App To Display Employee Details
Android App To Display Employee Details
Saikrishna Tanguturu
 
Android action bar and notifications-chapter16
Android action bar and notifications-chapter16Android action bar and notifications-chapter16
Android action bar and notifications-chapter16
Dr. Ramkumar Lakshminarayanan
 

Similar to Android Bootcamp Tanzania:intents (20)

Lab1-android
Lab1-androidLab1-android
Lab1-android
 
ANDROID
ANDROIDANDROID
ANDROID
 
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_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
 
Android application model
Android application modelAndroid application model
Android application model
 
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkkSWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
SWE218_lesson9.pdfjjjjjjjjjjjjjjjjjjkjkkk
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2
 
unit3.pptx
unit3.pptxunit3.pptx
unit3.pptx
 
Activity & Shared Preference
Activity & Shared PreferenceActivity & Shared Preference
Activity & Shared Preference
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)
 
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
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
 
Android Insights - 1 [Intents]
Android Insights - 1 [Intents]Android Insights - 1 [Intents]
Android Insights - 1 [Intents]
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
android activity
android activityandroid activity
android activity
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
 
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 App To Display Employee Details
Android App To Display Employee DetailsAndroid App To Display Employee Details
Android App To Display Employee Details
 
Android action bar and notifications-chapter16
Android action bar and notifications-chapter16Android action bar and notifications-chapter16
Android action bar and notifications-chapter16
 

More from Denis Minja

Android Bootcamp Tanzania:Monetization
Android Bootcamp Tanzania:MonetizationAndroid Bootcamp Tanzania:Monetization
Android Bootcamp Tanzania:Monetization
Denis Minja
 
Android Bootcamp Tanzania:Costech mobile bootcamp monetazation
Android Bootcamp Tanzania:Costech mobile bootcamp monetazationAndroid Bootcamp Tanzania:Costech mobile bootcamp monetazation
Android Bootcamp Tanzania:Costech mobile bootcamp monetazation
Denis Minja
 
Android Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifestAndroid Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifest
Denis Minja
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
Denis Minja
 
Costech mobile bootcamp 2
Costech mobile bootcamp 2Costech mobile bootcamp 2
Costech mobile bootcamp 2Denis Minja
 
Android Bootcamp Tanzania:Overview of android platform
Android Bootcamp Tanzania:Overview of android platformAndroid Bootcamp Tanzania:Overview of android platform
Android Bootcamp Tanzania:Overview of android platform
Denis Minja
 
Android Bootcamp Tanzania:Publishing android application
Android Bootcamp Tanzania:Publishing android applicationAndroid Bootcamp Tanzania:Publishing android application
Android Bootcamp Tanzania:Publishing android application
Denis Minja
 

More from Denis Minja (7)

Android Bootcamp Tanzania:Monetization
Android Bootcamp Tanzania:MonetizationAndroid Bootcamp Tanzania:Monetization
Android Bootcamp Tanzania:Monetization
 
Android Bootcamp Tanzania:Costech mobile bootcamp monetazation
Android Bootcamp Tanzania:Costech mobile bootcamp monetazationAndroid Bootcamp Tanzania:Costech mobile bootcamp monetazation
Android Bootcamp Tanzania:Costech mobile bootcamp monetazation
 
Android Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifestAndroid Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifest
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Costech mobile bootcamp 2
Costech mobile bootcamp 2Costech mobile bootcamp 2
Costech mobile bootcamp 2
 
Android Bootcamp Tanzania:Overview of android platform
Android Bootcamp Tanzania:Overview of android platformAndroid Bootcamp Tanzania:Overview of android platform
Android Bootcamp Tanzania:Overview of android platform
 
Android Bootcamp Tanzania:Publishing android application
Android Bootcamp Tanzania:Publishing android applicationAndroid Bootcamp Tanzania:Publishing android application
Android Bootcamp Tanzania:Publishing android application
 

Recently uploaded

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 

Recently uploaded (20)

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 

Android Bootcamp Tanzania:intents

  • 1.
  • 2.  An intent is an abstract description of an operation to be performed.  It can be used with startActivity to launch an Activity. An Intent provides a facility for performing late runtime binding between the code in different applications.   Its most significant use is in the launching of activities, where it can be thought of as the glue between activities.  It is basically a passive data structure holding an abstract description of an action to be performed.
  • 3.  The primary pieces of information in an intent are: ◦ action -- The general action to be performed, such as ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, etc. ◦ data -- The data to operate on, such as a person record in the contacts database, expressed as a Uri.
  • 4.  There are two primary forms of intents you will use.  Explicit Intents have specified a component (via setComponent(ComponentName) or setClass(Con text, 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.
  • 5.  Implicit Intents have not specified a component;  Instead, they must include enough information for the system to determine which of the available components is best to run for that intent.
  • 6.  Predefined actions (http://developer.android.com/reference/android/content/Intent.html) Action Name Description ACTION_CALL Initiate a phone call ACTION_EDIT Display data to edit ACTION_MAIN ACTION_VIEW Start as a main entry point, does not expect to receive data. Pick an item from the data, returning what was selected. Display the data to the user ACTION_SEARCH Perform a search ACTION_PICK  Defined by the programmer 6
  • 7. Intent i = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(i); Action to perform Data to perform the action on  Implicit intents are very useful to re-use code and to launch external applications …  M re tha n a Co m p o ne nt c a n m a tc h the I nt re q ue s t … o nte  How to define the target component? 7
  • 8.
  • 9.
  • 10.  In order to access external components in android, permissions needs to be set in Android Manifest file.
  • 12.  Explicit Intent: Specify the activity that will handle the intent.  The following shows how to move from First activity to second activity. Intent a =new Intent(FirstActivity.this, SecondActivity.class); startActivity(a); OR Intent about=new Intent(getApplicationContext(),About.class); startActivity(about); 12
  • 13.  Developers mostly create applications using different activities.  These activities needs to communicate and pass data from one part to the other.  For this case, Explicit Intents should be used.
  • 14.  For activities to be able to communicate to one another.  They must be registered in the manifest file.  This is done by adding all your activities in the manifest file.  This is done inside the <application> tag of the manifest
  • 15.
  • 16.  Labs – Joining Activities
  • 17. Creating an Options Menu  The options menu is where you should include actions and other options that are relevant to the current activity context.  ◦ Such as "Search“,”Save” "Compose email," and "Settings.“ ◦ Ref:  http://www.droidnova.com/how-to-create-an-option-menu,427.html
  • 18.
  • 19.  First we have to make a new folder in our res/layout directory .  In this new directory we will create a new xml file named menu.xml.  Put the following code.
  • 20.
  • 21.  The content of the xml file should be very self explaining.  We have an id for each item, so we have a reference for it.  The title attribute, if defined, is nothing more than the text you see in the option menu.
  • 22.  The same with the icon attribute which references to an icon, in our case the default icon.  Now we have to modify our Activity class.  First we have to override the method onCreateOptionsMenu()
  • 24.  Right now we can start our application and we will see our 3 option items in our menu when we press the menu button.  As long as nothing happens when we press one item, the menu is senseless.  To implement a reaction of our menu, we should override another method named onOptionsItemSelected().