0% found this document useful (0 votes)
11 views17 pages

Lec 15 MAD

Uploaded by

adnanriaz2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views17 pages

Lec 15 MAD

Uploaded by

adnanriaz2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Lecture No.

15 07-01-2025

Mobile Application Development

Instructor:
Ms. Atika Tanveer

1/13/2025 1
Using Built-in Intent to send SMS
 You can use Android Intent to send SMS by calling built-in SMS
functionality of the Android.
 Following section explains different parts of our Intent object
required to send an SMS.

1/13/2025 2
Intent Object - Action to send SMS
 You will use ACTION_VIEW action to launch an SMS client installed
on your Android device. Following is simple syntax to create an intent
with ACTION_VIEW action.

1/13/2025 3
Intent Object - Data/Type to send SMS
 To send an SMS you need to specify smsto: as URI using setData()
method and data type will be to vnd.android-dir/mms-sms using
setType() method as follows −

1/13/2025 4
Intent Object - Extra to send SMS
 Android has built-in support to add phone number and text message
to send an SMS as follows −

1/13/2025 5
Example
 Following example shows you in practical how to use Intent object to
launch SMS client to send an SMS to the given recipients.
Step Description
You will use Android studio IDE to create an Android application and name it
1
as tutorialspoint under a package com.example.tutorialspoint.
Modify src/MainActivity.java file and add required code to take care of sending
2
SMS.
Modify layout XML file res/layout/activity_main.xml add any GUI component if
3
required. I'm adding a simple button to launch SMS Client.
4 No need to define default constants.Android studio takes care of default constants.
5 Modify AndroidManifest.xml as shown below
Run the application to launch Android emulator and verify the result of the changes
6
done in the application.
1/13/2025 6
activity_main.xml

1/13/2025 7
MainActivity.java

1/13/2025 8
Output

1/13/2025 9
1/13/2025 10
Send an Email From an Android Application
Working with the XML Files
 go to the activity_main.xml file, which represents the UI of the project.
Below is the code for the activity_main.xml file. Comments are added inside
the code to understand the code in more detail. This file contains a Relative
Layout which contains three Edit texts for receiver mail id, another for the
subject of the mail, and last one for the body of the email, and three
TextViews for the label and a button for starting intent or sending mail:

1/13/2025 11
activity_main.xml

1/13/2025 12
1/13/2025 13
MainActivity.js

1/13/2025 14
MainActivity.js

1/13/2025 15
Output

1/13/2025 16
Thank You

1/13/2025 17

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy