I am trying to send an SMS from my android app. Every time I click on my button, it goes to catch
part rather then try
.
Here is my method:
Button sms = (Button)findViewById(R.id.button2);
sms.setOnClickListener(
new View.OnClickListener()
{
public void onClick(View view)
{
Log.i("Send SMS", "");
Intent sms = new Intent(Intent.ACTION_VIEW);
sms.setData(Uri.parse("smsto:"));
sms.setType("vnd.android-dir/mms-sms");
sms.putExtra("address", new String(con));
sms.putExtra("sms_body", "Test SMS to Angilla");
try {
startActivity(sms);
finish();
Log.i("Finished sending SMS...", "");
}
catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(DetailActivity.this,
"SMS faild, please try again later.", Toast.LENGTH_SHORT).show();
}
}
});