SlideShare a Scribd company logo
08. Intent (Explicit)
Oum Saokosal
Master of Engineering in Information Systems, South Korea
855-12-252-752
oum_saokosal@yahoo.com
Agenda
• What is Intent?
• Intent: Invoke another Activity explicitly
• Put Extra with Intent
What is Intent? (1)
• There are many uses of intent.
– You can use intents to invoke other applications
from your application.
– You can use intents to invoke internal or external
components from your application.
– You can use intents to raise events so that others
can respond in a manner similar to a publish-and
subscribe model.
What is Intent? (2)
• At the simplest level, an intent is an action that
you can tell Android to invoke. That is, you can
invoke activity 02 from activity 01.
• In order to invoke like that, you need to register
those activities in AndroidManifest.xml.
• See Example: IntentExplicit.
Intent: Invoke another Activity
explicitly
public class Activity01 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main01);
}
public void gotoProfile(View v){
Intent in = new Intent(this, Activity02.class);
startActivity(in);
}
}
main01.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Name: Oum Saokosal" />
……
……
……
<Button
android:onClick="gotoProfile"
android:id="@+id/btnProfile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Profile" />
</LinearLayout>
public class Activity02 extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main02);
}
public void backtoMain(View v){
Intent in = new Intent(this, Activity01.class);
startActivity(in);
}
}
main02.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Relationship: Engaged"
android:textAppearance="?android:attr/textAppearanceMedium" />
……
……
<Button
android:onClick="backtoMain"
android:id="@+id/btnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Back"/>
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kosalab" android:versionCode="1" android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="Intent Explicit" >
<activity
android:label="Activity01"
android:name=".Activity01" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="Activity02" android:name=".Activity02"></activity>
</application>
</manifest>
Put Extra with Intent
• In PHP, you can send data from a file to
another file through session.
• Similar to that, you can send data from one
Activity to other one by putting extra with
Intent.
• The extra data is in the form of key/value
pairs.
putExtra() into Intent
public class Activity01 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main01);
}
public void gotoProfile(View v){
Intent in = new Intent(this, Activity02.class);
in.putExtra("id", "4312");
startActivity(in);
}
}
getExtras() from getIntent
public class Activity02 extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main02);
Bundle extras = getIntent().getExtras();
if (extras != null) {
int id = 0;
if(extras.getString("id") != null){
id = Integer.parseInt(extras.getString("id"));
Toast.makeText(this,
"your id = " + id, Toast.LENGTH_LONG).show();
}
}
}
public void backtoMain(View v){
Intent in = new Intent(this, Activity01.class);
startActivity(in);
}
}
08.1. Android How to Use Intent (explicit)
Go on to the next slide
Ad

More Related Content

What's hot (20)

06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
Oum Saokosal
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidget
Krazy Koder
 
Android Widget
Android WidgetAndroid Widget
Android Widget
ELLURU Kalyan
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection Widget
Prajyot Mainkar
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
Daniela Da Cruz
 
Android components
Android componentsAndroid components
Android components
NAVEENA ESWARAN
 
Intents in Android
Intents in AndroidIntents in Android
Intents in Android
ma-polimi
 
Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities
Ahsanul Karim
 
Android - Android Intent Types
Android - Android Intent TypesAndroid - Android Intent Types
Android - Android Intent Types
Vibrant Technologies & Computers
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recievers
Utkarsh Mankad
 
Android Lesson 2
Android Lesson 2Android Lesson 2
Android Lesson 2
Daniela Da Cruz
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
Wingston
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
Robert Cooper
 
android activity
android activityandroid activity
android activity
Deepa Rani
 
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
 
Android app
Android appAndroid app
Android app
kartikeya verma
 
Android intent
Android intentAndroid intent
Android intent
Krazy Koder
 
Android App Development 07 : Intent &amp; Share
Android App Development 07 : Intent &amp; ShareAndroid App Development 07 : Intent &amp; Share
Android App Development 07 : Intent &amp; Share
Anuchit Chalothorn
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
C.o. Nieto
 
Android Tutorials : Basic widgets
Android Tutorials : Basic widgetsAndroid Tutorials : Basic widgets
Android Tutorials : Basic widgets
Prajyot Mainkar
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
Oum Saokosal
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidget
Krazy Koder
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection Widget
Prajyot Mainkar
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
Daniela Da Cruz
 
Intents in Android
Intents in AndroidIntents in Android
Intents in Android
ma-polimi
 
Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities
Ahsanul Karim
 
Android intents, notification and broadcast recievers
Android intents, notification and broadcast recieversAndroid intents, notification and broadcast recievers
Android intents, notification and broadcast recievers
Utkarsh Mankad
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
Wingston
 
android activity
android activityandroid activity
android activity
Deepa Rani
 
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
 
Android App Development 07 : Intent &amp; Share
Android App Development 07 : Intent &amp; ShareAndroid App Development 07 : Intent &amp; Share
Android App Development 07 : Intent &amp; Share
Anuchit Chalothorn
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
C.o. Nieto
 
Android Tutorials : Basic widgets
Android Tutorials : Basic widgetsAndroid Tutorials : Basic widgets
Android Tutorials : Basic widgets
Prajyot Mainkar
 

Viewers also liked (20)

07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)
Oum Saokosal
 
10.1. Android Audio
10.1. Android Audio10.1. Android Audio
10.1. Android Audio
Oum Saokosal
 
07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete
Oum Saokosal
 
11.1 Android with HTML
11.1 Android with HTML11.1 Android with HTML
11.1 Android with HTML
Oum Saokosal
 
10.3 Android Video
10.3 Android Video10.3 Android Video
10.3 Android Video
Oum Saokosal
 
04. Review OOP with Java
04. Review OOP with Java04. Review OOP with Java
04. Review OOP with Java
Oum Saokosal
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - Polymorphism
Oum Saokosal
 
Objected-Oriented Programming with Java
Objected-Oriented Programming with JavaObjected-Oriented Programming with Java
Objected-Oriented Programming with Java
Oum Saokosal
 
07.1. Android Even Handling
07.1. Android Even Handling07.1. Android Even Handling
07.1. Android Even Handling
Oum Saokosal
 
10.2 Android Audio with SD Card
10.2 Android Audio with SD Card10.2 Android Audio with SD Card
10.2 Android Audio with SD Card
Oum Saokosal
 
Java Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract ClassJava Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract Class
Oum Saokosal
 
Java Programming - Inheritance
Java Programming - InheritanceJava Programming - Inheritance
Java Programming - Inheritance
Oum Saokosal
 
12. Android Basic Google Map
12. Android Basic Google Map12. Android Basic Google Map
12. Android Basic Google Map
Oum Saokosal
 
Database Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS AccessDatabase Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS Access
Oum Saokosal
 
09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)
Oum Saokosal
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
Oum Saokosal
 
Java Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceJava Programming - Abstract Class and Interface
Java Programming - Abstract Class and Interface
Oum Saokosal
 
Natalie Portier, Appodeal
Natalie Portier, Appodeal	Natalie Portier, Appodeal
Natalie Portier, Appodeal
White Nights Conference
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Oum Saokosal
 
A Product Manager's Job
A Product Manager's JobA Product Manager's Job
A Product Manager's Job
joshelman
 
07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)
Oum Saokosal
 
10.1. Android Audio
10.1. Android Audio10.1. Android Audio
10.1. Android Audio
Oum Saokosal
 
07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete
Oum Saokosal
 
11.1 Android with HTML
11.1 Android with HTML11.1 Android with HTML
11.1 Android with HTML
Oum Saokosal
 
10.3 Android Video
10.3 Android Video10.3 Android Video
10.3 Android Video
Oum Saokosal
 
04. Review OOP with Java
04. Review OOP with Java04. Review OOP with Java
04. Review OOP with Java
Oum Saokosal
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - Polymorphism
Oum Saokosal
 
Objected-Oriented Programming with Java
Objected-Oriented Programming with JavaObjected-Oriented Programming with Java
Objected-Oriented Programming with Java
Oum Saokosal
 
07.1. Android Even Handling
07.1. Android Even Handling07.1. Android Even Handling
07.1. Android Even Handling
Oum Saokosal
 
10.2 Android Audio with SD Card
10.2 Android Audio with SD Card10.2 Android Audio with SD Card
10.2 Android Audio with SD Card
Oum Saokosal
 
Java Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract ClassJava Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract Class
Oum Saokosal
 
Java Programming - Inheritance
Java Programming - InheritanceJava Programming - Inheritance
Java Programming - Inheritance
Oum Saokosal
 
12. Android Basic Google Map
12. Android Basic Google Map12. Android Basic Google Map
12. Android Basic Google Map
Oum Saokosal
 
Database Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS AccessDatabase Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS Access
Oum Saokosal
 
09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)
Oum Saokosal
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
Oum Saokosal
 
Java Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceJava Programming - Abstract Class and Interface
Java Programming - Abstract Class and Interface
Oum Saokosal
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Oum Saokosal
 
A Product Manager's Job
A Product Manager's JobA Product Manager's Job
A Product Manager's Job
joshelman
 
Ad

Similar to 08.1. Android How to Use Intent (explicit) (20)

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
Ahsanul Karim
 
Activity & Shared Preference
Activity & Shared PreferenceActivity & Shared Preference
Activity & Shared Preference
nationalmobileapps
 
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
 
Intents in Mobile Application Development.pptx
Intents in  Mobile Application Development.pptxIntents in  Mobile Application Development.pptx
Intents in Mobile Application Development.pptx
AbinayaDeviC
 
ANDROID
ANDROIDANDROID
ANDROID
DrMeftahZouai
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
34ShreyaChauhan
 
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
 
learn about Android Extended Intents.pptx
learn about Android Extended Intents.pptxlearn about Android Extended Intents.pptx
learn about Android Extended Intents.pptx
adgeofspace04
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
maamir farooq
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activities
maamir farooq
 
Session #8 adding magic to your app
Session #8  adding magic to your appSession #8  adding magic to your app
Session #8 adding magic to your app
Vitali Pekelis
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介
easychen
 
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 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
 
Activity
ActivityActivity
Activity
NikithaNag
 
Activity
ActivityActivity
Activity
NikithaNag
 
Activity
ActivityActivity
Activity
roopa_slide
 
Activity
ActivityActivity
Activity
roopa_slide
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
Lope Emano
 
Android Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intentsAndroid Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intents
Denis Minja
 
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
Ahsanul Karim
 
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
 
Intents in Mobile Application Development.pptx
Intents in  Mobile Application Development.pptxIntents in  Mobile Application Development.pptx
Intents in Mobile Application Development.pptx
AbinayaDeviC
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
34ShreyaChauhan
 
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
 
learn about Android Extended Intents.pptx
learn about Android Extended Intents.pptxlearn about Android Extended Intents.pptx
learn about Android Extended Intents.pptx
adgeofspace04
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
maamir farooq
 
Lecture exercise on activities
Lecture exercise on activitiesLecture exercise on activities
Lecture exercise on activities
maamir farooq
 
Session #8 adding magic to your app
Session #8  adding magic to your appSession #8  adding magic to your app
Session #8 adding magic to your app
Vitali Pekelis
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介
easychen
 
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 development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
Lope Emano
 
Android Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intentsAndroid Bootcamp Tanzania:intents
Android Bootcamp Tanzania:intents
Denis Minja
 
Ad

Recently uploaded (20)

Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 

08.1. Android How to Use Intent (explicit)

  • 1. 08. Intent (Explicit) Oum Saokosal Master of Engineering in Information Systems, South Korea 855-12-252-752 [email protected]
  • 2. Agenda • What is Intent? • Intent: Invoke another Activity explicitly • Put Extra with Intent
  • 3. What is Intent? (1) • There are many uses of intent. – You can use intents to invoke other applications from your application. – You can use intents to invoke internal or external components from your application. – You can use intents to raise events so that others can respond in a manner similar to a publish-and subscribe model.
  • 4. What is Intent? (2) • At the simplest level, an intent is an action that you can tell Android to invoke. That is, you can invoke activity 02 from activity 01. • In order to invoke like that, you need to register those activities in AndroidManifest.xml. • See Example: IntentExplicit.
  • 5. Intent: Invoke another Activity explicitly
  • 6. public class Activity01 extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main01); } public void gotoProfile(View v){ Intent in = new Intent(this, Activity02.class); startActivity(in); } }
  • 7. main01.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Name: Oum Saokosal" /> …… …… …… <Button android:onClick="gotoProfile" android:id="@+id/btnProfile" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Profile" /> </LinearLayout>
  • 8. public class Activity02 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main02); } public void backtoMain(View v){ Intent in = new Intent(this, Activity01.class); startActivity(in); } }
  • 9. main02.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Relationship: Engaged" android:textAppearance="?android:attr/textAppearanceMedium" /> …… …… <Button android:onClick="backtoMain" android:id="@+id/btnBack" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Back"/> </LinearLayout>
  • 10. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.kosalab" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="10" /> <application android:icon="@drawable/ic_launcher" android:label="Intent Explicit" > <activity android:label="Activity01" android:name=".Activity01" > <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:label="Activity02" android:name=".Activity02"></activity> </application> </manifest>
  • 11. Put Extra with Intent • In PHP, you can send data from a file to another file through session. • Similar to that, you can send data from one Activity to other one by putting extra with Intent. • The extra data is in the form of key/value pairs.
  • 12. putExtra() into Intent public class Activity01 extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main01); } public void gotoProfile(View v){ Intent in = new Intent(this, Activity02.class); in.putExtra("id", "4312"); startActivity(in); } }
  • 13. getExtras() from getIntent public class Activity02 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main02); Bundle extras = getIntent().getExtras(); if (extras != null) { int id = 0; if(extras.getString("id") != null){ id = Integer.parseInt(extras.getString("id")); Toast.makeText(this, "your id = " + id, Toast.LENGTH_LONG).show(); } } } public void backtoMain(View v){ Intent in = new Intent(this, Activity01.class); startActivity(in); } }
  • 15. Go on to the next slide