Creating SMS Application in Android
In this video we are going to create SMS application in Android.
First of all we will design layout of our application, for that we will open main.xml file, and inside that we will see that we have taken one linearlayout, two TextView, and two EditText. We also have taken one Button which when user will click on, the SMS will be sent.
Now inside AndroidManifest.xml file, we will set certain permission like SEND_SMS and RECEIVE_SMS.
Now we will design the main code inside 'sms.java' folder. Here we have done View Identification of two EditText and one Button. We will design a switch case method here and use it.
public void sendSms(String phoneNumber, String message)
PendingIntent sentPi=PendingIntent.getBroadcast(this,0,new Intent(sent),0);
public void onReceive(Context context, Intent intent)
Similarly we will design other case and generate specific Toast notification for them.
Now we will design a Listener for our button,
public void onClick(View v)
Now we will run our code and see how it is executed. First of all we will be asked to enter a phone number, and then the Message. After that when we click on Send SMS button, it works successfully.
Have a friend to whom you would want to share this course?