SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Introduction to Android
Vidya T
opa Institute of P
rofessional Studies
www.vtips.org
Programming Tutorial(Applications)
• Transmitting SMS messages across the network
Intent and IntentFilter
Intents request for an action to be performed
and supports interaction among the Android
components.
◦ For an activity it conveys a request to present an image
to the user
◦ For broadcast receivers, the Intent object names the
action being announced.

Intent Filter Registers Activities, Services and
Broadcast Receivers(as being capable of
performing an action on a set of data).
SMS Sending
• STEP 1
– In the AndroidManifest.xml file, add the two permissions - SEND_SMS
and RECEIVE_SMS.

• STEP 2
– In the main.xml, add Text view to display "Enter the phone number of
recipient“ and "Message"
– EditText with id txtPhoneNo and txtMessage
– Add the button ID "Send SMS“
• Step 3 Import Classes and Interfaces
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
Step 4 Write the SMS class
public class SMS extends Activity {
Button btnSendSMS;
EditText txtPhoneNo;
EditText txtMessage;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo);
txtMessage = (EditText) findViewById(R.id.txtMessage);
btnSendSMS.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String phoneNo = txtPhoneNo.getText().toString();
String message = txtMessage.getText().toString();
if (phoneNo.length()>0 && message.length()>0)
sendSMS(phoneNo, message);
else
Toast.makeText(getBaseContext(),
"Please enter both phone number and message.",
Toast.LENGTH_SHORT).show();
}
});
}
}

SMS Sending

Input from the
user (i.e., the
phone no, text
message and
sendSMS is
implemented).
Step 5
◦ To send an SMS message, you use the SmsManager
class. And to instantiate this class call getDefault()
static method.
◦ The sendTextMessage() method sends the SMS
message with a PendingIntent.
◦ The PendingIntent object is used to identify a target
to invoke at a later time.
private void sendSMS(String phoneNumber, String message) {
PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, SMS.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, pi, null);
}

SMS Sending
SMS Sending

Receiving SMS
Find Us
• Facebookhttps://www.facebook.com/vtips.org
• Twitterhttps://twitter.com/v_vtips
• Linked Inhttp://www.linkedin.com/company/vtips

Weitere ähnliche Inhalte

Was ist angesagt? (8)

MEE1002ENGINEERING MECHANICS-SUM-II-L13
MEE1002ENGINEERING MECHANICS-SUM-II-L13MEE1002ENGINEERING MECHANICS-SUM-II-L13
MEE1002ENGINEERING MECHANICS-SUM-II-L13
 
MEE1002 Engineering Mechanics L29
MEE1002 Engineering Mechanics L29MEE1002 Engineering Mechanics L29
MEE1002 Engineering Mechanics L29
 
Part 6 filter using table record in vb.net
Part 6 filter using table record in vb.netPart 6 filter using table record in vb.net
Part 6 filter using table record in vb.net
 
Part 7 navigating through recordset in vb.net
Part 7 navigating through recordset in vb.netPart 7 navigating through recordset in vb.net
Part 7 navigating through recordset in vb.net
 
CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
 
Android chat app1
Android chat app1Android chat app1
Android chat app1
 
calling cards
calling cardscalling cards
calling cards
 
mediator
mediatormediator
mediator
 

Ähnlich wie Android introduction by vidya topa

Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
Ahsanul Karim
 

Ähnlich wie Android introduction by vidya topa (20)

Android
AndroidAndroid
Android
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Create an other activity lesson 3
Create an other activity lesson 3Create an other activity lesson 3
Create an other activity lesson 3
 
Create another activity and start it by intent
Create another activity and start it by intentCreate another activity and start it by intent
Create another activity and start it by intent
 
Android App Dev Manual-1.doc
Android App Dev Manual-1.docAndroid App Dev Manual-1.doc
Android App Dev Manual-1.doc
 
Notification android
Notification androidNotification android
Notification android
 
Creating a Facebook Clone - Part XIV - Transcript.pdf
Creating a Facebook Clone - Part XIV - Transcript.pdfCreating a Facebook Clone - Part XIV - Transcript.pdf
Creating a Facebook Clone - Part XIV - Transcript.pdf
 
Local Notification Tutorial
Local Notification TutorialLocal Notification Tutorial
Local Notification Tutorial
 
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
 
Android app
Android appAndroid app
Android app
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intent
 
Exercises
ExercisesExercises
Exercises
 
Creating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdfCreating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdf
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone call
 
Mobilizing Your Rails Application - LA Ruby Conference 2009
Mobilizing Your Rails Application - LA Ruby Conference 2009Mobilizing Your Rails Application - LA Ruby Conference 2009
Mobilizing Your Rails Application - LA Ruby Conference 2009
 
Android intents in android application-chapter7
Android intents in android application-chapter7Android intents in android application-chapter7
Android intents in android application-chapter7
 
Android
AndroidAndroid
Android
 
Lab1-android
Lab1-androidLab1-android
Lab1-android
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
 

Mehr von Vidya Topa Institute of Professional Studies

Mehr von Vidya Topa Institute of Professional Studies (7)

Vtips matlab course content
Vtips matlab course contentVtips matlab course content
Vtips matlab course content
 
Matlab training Introduction at VTIPS
Matlab training Introduction at VTIPSMatlab training Introduction at VTIPS
Matlab training Introduction at VTIPS
 
Chalo america
Chalo americaChalo america
Chalo america
 
Advance microsoft excel institute in delhi
Advance microsoft excel institute in delhiAdvance microsoft excel institute in delhi
Advance microsoft excel institute in delhi
 
Php Training Workshop by Vtips
Php Training Workshop by VtipsPhp Training Workshop by Vtips
Php Training Workshop by Vtips
 
SEO Training and Workshop Presentation by Vidya Topa Professional Studies
SEO Training and Workshop Presentation by Vidya Topa Professional StudiesSEO Training and Workshop Presentation by Vidya Topa Professional Studies
SEO Training and Workshop Presentation by Vidya Topa Professional Studies
 
Java Training in New Delhi Lajpat Nagar
Java Training in New Delhi Lajpat NagarJava Training in New Delhi Lajpat Nagar
Java Training in New Delhi Lajpat Nagar
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

Android introduction by vidya topa

  • 1. Introduction to Android Vidya T opa Institute of P rofessional Studies www.vtips.org
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. Programming Tutorial(Applications) • Transmitting SMS messages across the network
  • 17. Intent and IntentFilter Intents request for an action to be performed and supports interaction among the Android components. ◦ For an activity it conveys a request to present an image to the user ◦ For broadcast receivers, the Intent object names the action being announced. Intent Filter Registers Activities, Services and Broadcast Receivers(as being capable of performing an action on a set of data).
  • 18. SMS Sending • STEP 1 – In the AndroidManifest.xml file, add the two permissions - SEND_SMS and RECEIVE_SMS. • STEP 2 – In the main.xml, add Text view to display "Enter the phone number of recipient“ and "Message" – EditText with id txtPhoneNo and txtMessage – Add the button ID "Send SMS“
  • 19. • Step 3 Import Classes and Interfaces import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsManager; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast;
  • 20. Step 4 Write the SMS class public class SMS extends Activity { Button btnSendSMS; EditText txtPhoneNo; EditText txtMessage; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnSendSMS = (Button) findViewById(R.id.btnSendSMS); txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo); txtMessage = (EditText) findViewById(R.id.txtMessage); btnSendSMS.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String phoneNo = txtPhoneNo.getText().toString(); String message = txtMessage.getText().toString(); if (phoneNo.length()>0 && message.length()>0) sendSMS(phoneNo, message); else Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); } }); } } SMS Sending Input from the user (i.e., the phone no, text message and sendSMS is implemented).
  • 21. Step 5 ◦ To send an SMS message, you use the SmsManager class. And to instantiate this class call getDefault() static method. ◦ The sendTextMessage() method sends the SMS message with a PendingIntent. ◦ The PendingIntent object is used to identify a target to invoke at a later time. private void sendSMS(String phoneNumber, String message) { PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, SMS.class), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, pi, null); } SMS Sending
  • 23.
  • 24.
  • 25. Find Us • Facebookhttps://www.facebook.com/vtips.org • Twitterhttps://twitter.com/v_vtips • Linked Inhttp://www.linkedin.com/company/vtips