title: Android-Sending sms from android application
body: <p>This is my code.I have added permission in manifest file but then my app is unfortunately stopped.Why is it so?
  If i had try catch,catch part is getting executed.</p>
  
  <pre><code>    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;
      public class SendSMSActivity extends Activity {
  /** Called when the activity is first created. */
  EditText eTextMsg, eTextMblNumber;
  Button btnSendSMS;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      eTextMblNumber = (EditText) findViewById(R.id.etextMblNumber);
      eTextMsg = (EditText) findViewById(R.id.etextMsg);
      btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
      btnSendSMS.setOnClickListener(new OnClickListener()
      {
          public void onClick(View v) {
              // TODO Auto-generated method stub
              sendSMS();
          }
      });
  }
  public void sendSMS()
  {
      SmsManager sm = SmsManager.getDefault();
      String number = eTextMblNumber.getText().toString();
      String msg = eTextMsg.getText().toString();
      sm.sendTextMessage(number, null, msg, null, null);
  }
  </code></pre>