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.
I have set a sendSMS method for send button but, when I press send button it didn’t call to sendSMS method.
How to set a method for send button in Message compose screen? please help me.
Is it possible to set method for send button?
Thanks in Advance
Source code for your reference:
Texts.Java class
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");
}
}
message_tab_screen.xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<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 " />
</RelativeLayout>

Creating a SMS Application in Android?
http://mobiforge.com/developing/story/sms-messaging-android
Try this example to create custom SMS application and set your action for the send button.