I found some code for sending message through whatsapp. Something like this:
Button send=(Button)findViewById(R.id.sendbtn);
EditText input=(EditText)findViewById(R.id.inputtxt);
final String txt=input.getText().toString();
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent sendIntent=new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,txt);
sendIntent.setType("text/plain");
sendIntent.setPackage("com.whatsapp");
startActivity(sendIntent);
}
});`
The code is working but when the whatsapp screen shows up and i select a contact, my whatsapp closes and my application shows up. Is there anything else to be added to send a message?