Skip to content

Instantly share code, notes, and snippets.

@menuka94
Created January 26, 2017 17:31
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 menuka94/6cc5f880b126b973d43f96f825663e00 to your computer and use it in GitHub Desktop.
Save menuka94/6cc5f880b126b973d43f96f825663e00 to your computer and use it in GitHub Desktop.
Android Intents
// Executed in an Activity, so 'this' is the context
Intent intent = new Intent(this, NumbersActivity.class);
startActivity(intent);
// Create the text message with a string
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_SUBJECT, "Just Java order for " + name);
intent.putExtra(Intent.EXTRA_TEXT, priceMessage);
// Verify that the intent will resolve properly
if(sendIntent.resolveActivity(getPackageManager()) != null){
startActivity(intent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment