1
message = ((TextView)findViewById(R.id.message)).getText().toString().trim();
number = ((TextView)findViewById(R.id.phone)).getText().toString().trim();
Uri uri = Uri.parse("smsto:" + number);
Intent sendIntent = new Intent(Intent.ACTION_SENDTO, uri);
//this will cause code to crash with No Activity found to handle Intent
//sendIntent.setType("text/plain"); 
sendIntent.putExtra(Intent.EXTRA_TEXT, message);
sendIntent.setPackage("com.whatsapp");
startActivity(sendIntent);

This code open up the correct user whose phone number I typed but the EXTRA_TEXT message is not pre-populated in the whatsapp text box. What am I doing wrong ?

Jai Mani
  • 11
  • 1
  • 2

0 Answers0