title: How do I send a text message in Android?
body: <p>How do I send a text message? It seems simple but it doesn't work for me.</p>
  
  <p>I have the permission in the manifest:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.healthapp.healthapp"&gt;
  
  &lt;uses-permission android:name="android.permission.SEND_SMS"/&gt;
  
  &lt;application   ...
  </code></pre>
  
  <p>I then have this code in my onClick:</p>
  
  <pre><code>SmsManager smsManager = SmsManager.getDefault();
  
  smsManager.sendTextMessage("07123456789", null, "Hello there!", null, null);
  
  Intent sendIntent = new Intent(Intent.ACTION_VIEW);
  sendIntent.putExtra("sms_body", "default content");
  sendIntent.setType("vnd.android-dir/mms-sms");
                              startActivity(sendIntent);
  </code></pre>
  
  <p>But when I run this I get "Unfortunately App has stopped."</p>
  
  <p>And the error message of:</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.healthapp.healthapp, PID: 13477
  android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW typ=vnd.android-dir/mms-sms (has extras) }
  </code></pre>