SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Android basics:
Activities and Intents
This tutorial presentation will guide you through
some basic components of android application
and their usage during android application
development.
2
Android:
● Android is an open source and
Linux-based operating system for
mobile devices such as
smartphones and tablet computers.
● Android was developed by the
Open Handset Alliance, led by
Google, and other companies.
3
Android Applications:
● Android apps have their own process and thus lives in
their own world.
● Android app files are only visible to the app.
● Android apps can make use of other applications and
share information among them.
● Android apps are build using andorid components with
which all above things work smoothly.
4
An android app consists of following basic components:
Activity
An activity represents a single screen with a user interface
Activity is the User visible Window
Activity performs actions on the screen
For eg. an email application might have one activity that shows a list of new emails, another
activity to compose an email, and another activity for reading emails
If an application has more than one activity, then one of them should be marked as the
activity that is presented first when the application is launched
An activity is implemented as a subclass of Activity class as follows-
public class YourActivity extends Activity {
}
Android Component: Activity
5
Android Component: Service
A service is basically a component that runs in the background to
perform long-running operations.
For example, a service might play music in the background while the
user is in a different application, or it might fetch data over the
network without blocking user interaction with the current visible
activity.
A service is implemented as a subclass of Service class as follows −
public class YourService extends Service {
}
6
Android Component: BroadCast Receiver
Broadcast Receivers simply respond to broadcast messages from other
applications or from the system. For example, applications can also initiate
broadcasts to let other applications know that some data has been downloaded
to the device and is available for them to use, so this is broadcast receiver who
will intercept this communication and will initiate appropriate action.
A broadcast receiver is implemented as a subclass of BroadcastReceiver class
and each message is broadcasted as an Intent object.
public class YourReceiver extends BroadcastReceiver {
public void onReceive(context,intent){ }
}
7
Android Component: Content Provider
A content provider component supplies data from one application to others
on request.
Such requests are handled by the methods of the ContentResolver class.
The data shared with others may be stored in the file system, the database or
somewhere else entirely.
A content provider is implemented as a subclass of ContentProvider class
and must implement a standard set of APIs that enable other applications to
perform transactions.
public class YourContentProvider extends ContentProvider {
public void onCreate(){}
}
8
Android Manifest:
● Every android application holds an application description file
named as AndroidManifest.xml which resides at the root of the
application project directory.
● This file works as an interface between Android OS and our
application.
● Whatever component we use as a part of our application
development procedure , we declare them all in this manifest file.
● if we do not declare our components in this file, then it will not be
considered by the OS.
9
Android Activity in detail:
As you know every program starts
from main() function like in C, C++
or Java programming language,
similarly, Android system initiates
its program with in an Activity
starting with a call on onCreate()
callback method. There is a
sequence of callback methods that
start up an activity and a sequence
of callback methods that tear down
an activity
10
An Activity Lifecycle
onCreate() This is the first callback and called when the activity is first created.
onStart() This callback is called when the activity becomes visible to the user.
onResume() This is called when the user starts interacting with the application.
OnPause() The paused activity does not receive user input and cannot execute any
code and called when the current activity is being paused and the
previous activity is being resumed.
onStop() This callback is called when the activity is no longer visible.
onDestroy() This callback is called before the activity is destroyed by the system.
onRestart() This callback is called when the activity restarts after stopping it.
11
Android: Intent
“The intent itself, an Intent object, is a passive data
structure holding an abstract description of an operation to
be performed”
● An Android Intent is an abstract description of an operation to be
performed.
● An intent can be used with:
startActivity to launch an Activity
broadcastIntent to send it to required BroadcastReceiver components
startService(Intent) or bindService(Intent, ServiceConnection, int) to
communicate with a background Service.
12
Android Intent: Types
● An Intent object is a bundle of
information which is used by the
component that receives the intent
as well as information used by the
Android system.
● There are basically two types of
intents:
Explicit Intent
Implicit Intent
13
Intent: Explicit Intent
● Explicit intent is used to connect the
internal world of the application
● These intents designate the target
component by its name and they are
typically used for application internal
messages
● If we want to connect one activity to
another, we can do this by an explicit
intent.
// Explicit Intent by specifying its class name
Intent i = new Intent(FirstActivity.this, SecondActivity.class);
// Starts TargetActivity
startActivity(i);
14
Intent: Implicit Intent
● These intents do not name a target and
the field for the component name is left
blank.
● Implicit intents are often used to
activate components in other
applications.
● The target component which receives
the intent can use the getExtras()
method to get the extra data sent by the
source component.
// Implicit Intent call
Intent read1=new Intent();
read1.setAction(android.content.Intent.ACTION_VIEW);
read1.setData(ContactsContract.Contacts.CONTENT_URI);
startActivity(read1);
// get Intent to fetch the values
Bundle extras = getIntent().getExtras();
// Extract data using passed keys
String value1 = extras.getString("Key1");
String value2 = extras.getString("Key2");
15
The implementation of the android components
just told about will be shown to you now.
Thank you.

Weitere ähnliche Inhalte

Was ist angesagt?

[Android] Intent and Activity
[Android] Intent and Activity[Android] Intent and Activity
[Android] Intent and ActivityNikmesoft Ltd
 
View groups containers
View groups containersView groups containers
View groups containersMani Selvaraj
 
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 intentDiego Grancini
 
Android Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifestAndroid Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifestDenis Minja
 
Android Components & Manifest
Android Components & ManifestAndroid Components & Manifest
Android Components & Manifestma-polimi
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesAhsanul Karim
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cyclemssaman
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversCodeAndroid
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & viewsma-polimi
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in androidOum Saokosal
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycleAhsanul Karim
 
Android architecture
Android architecture Android architecture
Android architecture Trong-An Bui
 

Was ist angesagt? (20)

[Android] Intent and Activity
[Android] Intent and Activity[Android] Intent and Activity
[Android] Intent and Activity
 
View groups containers
View groups containersView groups containers
View groups containers
 
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
 
Android Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifestAndroid Bootcamp Tanzania: android manifest
Android Bootcamp Tanzania: android manifest
 
Android Components & Manifest
Android Components & ManifestAndroid Components & Manifest
Android Components & Manifest
 
Unit2
Unit2Unit2
Unit2
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through Activities
 
Android session 2
Android session 2Android session 2
Android session 2
 
Android Lesson 2
Android Lesson 2Android Lesson 2
Android Lesson 2
 
Android session 3
Android session 3Android session 3
Android session 3
 
Android session 1
Android session 1Android session 1
Android session 1
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android Life Cycle
Android Life CycleAndroid Life Cycle
Android Life Cycle
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
Android Widget
Android WidgetAndroid Widget
Android Widget
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in android
 
android layouts
android layoutsandroid layouts
android layouts
 
Day 4: Activity lifecycle
Day 4: Activity lifecycleDay 4: Activity lifecycle
Day 4: Activity lifecycle
 
Android architecture
Android architecture Android architecture
Android architecture
 

Ähnlich wie Ppt 2 android_basics

MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx34ShreyaChauhan
 
Android application-component
Android application-componentAndroid application-component
Android application-componentLy Haza
 
android_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semandroid_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semaswinbiju1652
 
Android application development
Android application developmentAndroid application development
Android application developmentMd. Mujahid Islam
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentalsAmr Salman
 
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 developer interview questions with answers pdf
Android developer interview questions with answers pdfAndroid developer interview questions with answers pdf
Android developer interview questions with answers pdfazlist247
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recieversUtkarsh Mankad
 
Android interview questions and answers
Android interview questions and answersAndroid interview questions and answers
Android interview questions and answerskavinilavuG
 
Hello android world
Hello android worldHello android world
Hello android worldeleksdev
 
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.pdfAbdullahMunir32
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorialnirajsimulanis
 
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
 

Ähnlich wie Ppt 2 android_basics (20)

MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
 
Android application-component
Android application-componentAndroid application-component
Android application-component
 
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 development
Android application developmentAndroid application development
Android application development
 
Android Basic- CMC
Android Basic- CMCAndroid Basic- CMC
Android Basic- CMC
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentals
 
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 developer interview questions with answers pdf
Android developer interview questions with answers pdfAndroid developer interview questions with answers pdf
Android developer interview questions with answers pdf
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recievers
 
Android interview questions and answers
Android interview questions and answersAndroid interview questions and answers
Android interview questions and answers
 
Hello android world
Hello android worldHello android world
Hello android world
 
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
 
Mobile testing android
Mobile testing   androidMobile testing   android
Mobile testing android
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorial
 
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...)
 
Android basics
Android basicsAndroid basics
Android basics
 
ANDROID
ANDROIDANDROID
ANDROID
 
Notes Unit3.pptx
Notes Unit3.pptxNotes Unit3.pptx
Notes Unit3.pptx
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 

Kürzlich hochgeladen

哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...wyqazy
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceanilsa9823
 
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Niamh verma
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Pooja Nehwal
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceanilsa9823
 
9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7Pooja Nehwal
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPsychicRuben LoveSpells
 

Kürzlich hochgeladen (8)

哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
 
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Shalimar Bagh Delhi reach out to us at 🔝8264348440🔝
 
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
 
9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
 

Ppt 2 android_basics

  • 1. Android basics: Activities and Intents This tutorial presentation will guide you through some basic components of android application and their usage during android application development.
  • 2. 2 Android: ● Android is an open source and Linux-based operating system for mobile devices such as smartphones and tablet computers. ● Android was developed by the Open Handset Alliance, led by Google, and other companies.
  • 3. 3 Android Applications: ● Android apps have their own process and thus lives in their own world. ● Android app files are only visible to the app. ● Android apps can make use of other applications and share information among them. ● Android apps are build using andorid components with which all above things work smoothly.
  • 4. 4 An android app consists of following basic components: Activity An activity represents a single screen with a user interface Activity is the User visible Window Activity performs actions on the screen For eg. an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails If an application has more than one activity, then one of them should be marked as the activity that is presented first when the application is launched An activity is implemented as a subclass of Activity class as follows- public class YourActivity extends Activity { } Android Component: Activity
  • 5. 5 Android Component: Service A service is basically a component that runs in the background to perform long-running operations. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with the current visible activity. A service is implemented as a subclass of Service class as follows − public class YourService extends Service { }
  • 6. 6 Android Component: BroadCast Receiver Broadcast Receivers simply respond to broadcast messages from other applications or from the system. For example, applications can also initiate broadcasts to let other applications know that some data has been downloaded to the device and is available for them to use, so this is broadcast receiver who will intercept this communication and will initiate appropriate action. A broadcast receiver is implemented as a subclass of BroadcastReceiver class and each message is broadcasted as an Intent object. public class YourReceiver extends BroadcastReceiver { public void onReceive(context,intent){ } }
  • 7. 7 Android Component: Content Provider A content provider component supplies data from one application to others on request. Such requests are handled by the methods of the ContentResolver class. The data shared with others may be stored in the file system, the database or somewhere else entirely. A content provider is implemented as a subclass of ContentProvider class and must implement a standard set of APIs that enable other applications to perform transactions. public class YourContentProvider extends ContentProvider { public void onCreate(){} }
  • 8. 8 Android Manifest: ● Every android application holds an application description file named as AndroidManifest.xml which resides at the root of the application project directory. ● This file works as an interface between Android OS and our application. ● Whatever component we use as a part of our application development procedure , we declare them all in this manifest file. ● if we do not declare our components in this file, then it will not be considered by the OS.
  • 9. 9 Android Activity in detail: As you know every program starts from main() function like in C, C++ or Java programming language, similarly, Android system initiates its program with in an Activity starting with a call on onCreate() callback method. There is a sequence of callback methods that start up an activity and a sequence of callback methods that tear down an activity
  • 10. 10 An Activity Lifecycle onCreate() This is the first callback and called when the activity is first created. onStart() This callback is called when the activity becomes visible to the user. onResume() This is called when the user starts interacting with the application. OnPause() The paused activity does not receive user input and cannot execute any code and called when the current activity is being paused and the previous activity is being resumed. onStop() This callback is called when the activity is no longer visible. onDestroy() This callback is called before the activity is destroyed by the system. onRestart() This callback is called when the activity restarts after stopping it.
  • 11. 11 Android: Intent “The intent itself, an Intent object, is a passive data structure holding an abstract description of an operation to be performed” ● An Android Intent is an abstract description of an operation to be performed. ● An intent can be used with: startActivity to launch an Activity broadcastIntent to send it to required BroadcastReceiver components startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.
  • 12. 12 Android Intent: Types ● An Intent object is a bundle of information which is used by the component that receives the intent as well as information used by the Android system. ● There are basically two types of intents: Explicit Intent Implicit Intent
  • 13. 13 Intent: Explicit Intent ● Explicit intent is used to connect the internal world of the application ● These intents designate the target component by its name and they are typically used for application internal messages ● If we want to connect one activity to another, we can do this by an explicit intent. // Explicit Intent by specifying its class name Intent i = new Intent(FirstActivity.this, SecondActivity.class); // Starts TargetActivity startActivity(i);
  • 14. 14 Intent: Implicit Intent ● These intents do not name a target and the field for the component name is left blank. ● Implicit intents are often used to activate components in other applications. ● The target component which receives the intent can use the getExtras() method to get the extra data sent by the source component. // Implicit Intent call Intent read1=new Intent(); read1.setAction(android.content.Intent.ACTION_VIEW); read1.setData(ContactsContract.Contacts.CONTENT_URI); startActivity(read1); // get Intent to fetch the values Bundle extras = getIntent().getExtras(); // Extract data using passed keys String value1 = extras.getString("Key1"); String value2 = extras.getString("Key2");
  • 15. 15 The implementation of the android components just told about will be shown to you now. Thank you.