title: An Intent that sends SMS message
body: <p>this is going to be a newbie question, but I'm curious how Intent's ACTION_SENDTO works. The code is like this:</p>
  
  <pre><code>TextView textView = (TextView) findViewById(R.id.number_to_call);
  String smsNumber = String.format("smsto: %s", textView.getText().toString());
  EditText smsEditText = (EditText) findViewById(R.id.sms_message);
  String sms = smsEditText.getText().toString();    
  Intent smsIntent = new Intent(Intent.ACTION_SENDTO);
  smsIntent.setData(Uri.parse(smsNumber));
  smsIntent.putExtra("sms_body", sms);
  </code></pre>
  
  <p>I understand that:</p>
  
  <ul>
  <li>This is an implicit intent</li>
  <li>ACTION_SENDTO is the action of the intent</li>
  <li>setData takes in data of the intent</li>
  </ul>
  
  <p>But whatever in putExtra, I guess what it does is putting in "extra" data? Immediate after running this intent, it takes me to a normal Messages app with number as smsNumber, and sms as content. My questions are:</p>
  
  <ol>
  <li>How does the intent "know" smsNumber should be in the phone number section, and sms is in content section?</li>
  <li>I also guess the name "sms_body" does affect the role of the data after it (aka sms is the content of message)?</li>
  </ol>
  
  <p>Edit: I found an explanation for this. It should be in <a href="https://developer.android.com/guide/components/intents-common#Messaging" rel="nofollow noreferrer">Common Intents</a></p>