Skip to content

Instantly share code, notes, and snippets.

@dynoChris
Created November 30, 2018 06:57
Show Gist options
  • Save dynoChris/8d99526edcbab3807d7fd95864b4a428 to your computer and use it in GitHub Desktop.
Save dynoChris/8d99526edcbab3807d7fd95864b4a428 to your computer and use it in GitHub Desktop.
How to send simple text with Intent in Android
String text = "some text";
shareText(text);
private void shareText(String text) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(shareIntent, "Share text"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment