I have made an android app on android studio, from that application I want to send a message to a number but via whatsapp. The number is not in my contact list. I have tried the following code found on stackoverflow:
Uri mUri = Uri.parse("smsto:+999999999");
Intent mIntent = new Intent(Intent.ACTION_SENDTO, mUri);
mIntent.setPackage("com.whatsapp");
mIntent.putExtra("sms_body", "The text goes here");
mIntent.putExtra("chat",true);
startActivity(mIntent);
But it throws an exception "Activity not found".
I have also found one code but it opens the chat screen which I don't want means the user should only get a toast that message is sent and not any other screen.
If anybody has a solution please let me know.