title: How to send a message in Android?
body: <p>Currently I am working in message compose screen in Android, Using Intent to show message compose screen, then I have enter the phone number and messages.</p>
  
  <p>I have set a <code>sendSMS</code> method for send button but, when I press send button it didn't call to <code>sendSMS</code>  method.</p>
  
  <p>How to set a method for send button in Message compose screen? please help me.
  Is it possible to set method for send button?</p>
  
  <p>Thanks in Advance</p>
  
  <p>Source code for your reference:</p>
  
  <p><strong>Texts.Java class</strong></p>
  
  <pre><code>public class Texts extends Activity
  {
       public void onCreate(Bundle savedInstanceState)
       {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.message_tab_screen);
  
              Button Compose =(Button) findViewById(R.id.button1);
              Compose.setOnClickListener(new Button.OnClickListener() 
              {
                  public void onClick(View v)
                  {
                      Intent intent = new Intent("android.intent.action.VIEW");
                      intent.putExtra("sms_body", "");
                      Uri data = Uri.parse("sms:");
                      intent.setData(data);
                      startActivity(intent);
                  }
              });
       }
  
       //---sends an SMS message method
          private void sendSMS(String phoneNumber, String message)
          {        
                      System.out.println("SEND MESSAGE");
          }    
  
  
  }
  </code></pre>
  
  <p><strong>message_tab_screen.xml</strong> file</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical" &gt;
  
          &lt;Button
              android:id="@+id/button1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true"
              android:layout_alignParentTop="true"
              android:text="Message Compose " /&gt;       
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/uPuQX.png" alt="enter image description here"></p>