Skip to content

Instantly share code, notes, and snippets.

@JuniiiSays
Created September 12, 2022 15:10
Show Gist options
  • Save JuniiiSays/6aa228e15d343cecaf1bac57eeeac56b to your computer and use it in GitHub Desktop.
Save JuniiiSays/6aa228e15d343cecaf1bac57eeeac56b to your computer and use it in GitHub Desktop.
Android: Share plain text using intent (to all messaging apps)
Intent txtIntent = new Intent(android.content.Intent.ACTION_SEND);
txtIntent .setType("text/plain");
txtIntent .putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
txtIntent .putExtra(android.content.Intent.EXTRA_TEXT, body);
startActivity(Intent.createChooser(txtIntent ,"Share"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment