Created
November 30, 2018 06:57
-
-
Save dynoChris/8d99526edcbab3807d7fd95864b4a428 to your computer and use it in GitHub Desktop.
How to send simple text with Intent in Android
This file contains 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
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