package com.estimote.examples.demos;

import android.app.Activity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class SMSActivity extends Activity {
	Button buttonSend;
	EditText textPhoneNo;
	EditText textSMS;
 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.main);
		Bundle extras = getIntent().getExtras();
		String sms = "Patient " + extras.getString("patientName") + " outside range!!!";
		
		try {
			SmsManager smsManager = SmsManager.getDefault();
			smsManager.sendTextMessage("4388222753", null, sms, null, null);
			Toast.makeText(getApplicationContext(), "SMS Sent!",
						Toast.LENGTH_LONG).show();
		  } catch (Exception e) {
			Toast.makeText(getApplicationContext(),
				"SMS faild, please try again later!",
				Toast.LENGTH_LONG).show();
			e.printStackTrace();
		  }
 
//		buttonSend = (Button) findViewById(R.id.buttonSend);
//		textPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
//		textSMS = (EditText) findViewById(R.id.editTextSMS);
 
//		buttonSend.setOnClickListener(new OnClickListener() {
// 
//			@Override
//			public void onClick(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 faild, please try again later!",
//					Toast.LENGTH_LONG).show();
//				e.printStackTrace();
//			  }
// 
//			}
//		});
	}
}

@@ -1050,859 +1050,8 @@
   %7D%0A
- %0A//%09%09buttonSend = (Button) findViewById(R.id.buttonSend);%0A//%09%09textPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);%0A//%09%09textSMS = (EditText) findViewById(R.id.editTextSMS);%0A %0A//%09%09buttonSend.setOnClickListener(new OnClickListener() %7B%0A// %0A//%09%09%09@Override%0A//%09%09%09public void onClick(View v) %7B%0A// %0A//%09%09%09  String phoneNo = textPhoneNo.getText().toString();%0A//%09%09%09  String sms = textSMS.getText().toString();%0A// %0A//%09%09%09  try %7B%0A//%09%09%09%09SmsManager smsManager = SmsManager.getDefault();%0A//%09%09%09%09smsManager.sendTextMessage(phoneNo, null, sms, null, null);%0A//%09%09%09%09Toast.makeText(getApplicationContext(), %22SMS Sent!%22,%0A//%09%09%09%09%09%09%09Toast.LENGTH_LONG).show();%0A//%09%09%09  %7D catch (Exception e) %7B%0A//%09%09%09%09Toast.makeText(getApplicationContext(),%0A//%09%09%09%09%09%22SMS faild, please try again later!%22,%0A//%09%09%09%09%09Toast.LENGTH_LONG).show();%0A//%09%09%09%09e.printStackTrace();%0A//%09%09%09  %7D%0A// %0A//%09%09%09%7D%0A//%09%09%7D);%0A
 %09%7D%0A%7D

Update SMSActivity.java