Android Open Source - MobileDev_beginner sms Menu






From Project

Back to project page MobileDev_beginner.

License

The source code is released under:

This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...

If you think the Android project MobileDev_beginner listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.corruptor.smssender;
/*from w  w  w .  j a  va  2 s.  c o m*/
import android.app.Activity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
//import android.content.Intent;

public class smsMenu extends Activity{
  
  EditText textPhoneNo;
  EditText textSMS;

  protected void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.smslayout);
    textPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
    textSMS = (EditText) findViewById(R.id.editTextSMS);
  }
  
  public void sendsms(View v)
  {
    String phoneNo = textPhoneNo.getText().toString();
    String sms = textSMS.getText().toString();
    try 
    {
      SmsManager smsManager = SmsManager.getDefault();
      smsManager.sendTextMessage(phoneNo, null, sms, null, null);
      Toast.makeText(getApplicationContext(), "SMS Sent!",
      Toast.LENGTH_LONG).show();
    }
    catch(Exception e) 
    {
      Toast.makeText(getApplicationContext(),
      "SMS failed, please try again later!",
      Toast.LENGTH_LONG).show();
      e.printStackTrace();
    }
  }
}




Java Source Code List

.CheckBoxTest.java
.Demo.java
.ListTest.java
.OurServlet.java
.TextFieldTest.java
com.corruptor.smssender.smsMenu.java
com.example.login.insidemenu.java
com.example.login.loginact.java
org.corruptor.Booking.java
org.corruptor.Car.java
org.corruptor.Customer.java
org.corruptor.Login.java
org.corruptor.Menu.java
org.corruptor.MyConnection.java
org.corruptor.MyMain.java
org.corruptor.MyScanner.java
org.corruptor.Reports.java