Skip to content

Instantly share code, notes, and snippets.

@ShanakaWickramaarachchi
Created April 6, 2017 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShanakaWickramaarachchi/27de310dbf3dbb2d141125fc2724b46a to your computer and use it in GitHub Desktop.
Save ShanakaWickramaarachchi/27de310dbf3dbb2d141125fc2724b46a to your computer and use it in GitHub Desktop.
public class sms extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sms);
}
public void composeMmsMessage(String message, Uri attachment) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setData(Uri.parse("smsto:77000")); // This ensures only SMS apps respond
intent.putExtra("sms_body","Reg supa");
// intent.putExtra(Intent.EXTRA_STREAM, attachment);
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