Created
September 3, 2018 12:35
-
-
Save shubhamnikam/bc411f4337b0ca1be8659b4f8872d4f4 to your computer and use it in GitHub Desktop.
Implicit Intent - SMS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
intentSMS.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
Intent intent = new Intent(Intent.ACTION_SENDTO); | |
String phoneNumber = "1234567890"; | |
String message = "hey there..."; | |
intent.setData(Uri.parse("smsto:" + phoneNumber)); | |
intent.putExtra("sms_body", message); | |
if (intent.resolveActivity(getPackageManager()) != null) { | |
startActivity(intent); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment