Search This Blog

Android intent to share text via social media apps and sites

Use this code snippet to share text via social media apps in Java programming languages.
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
String shareBody = "text to share via social apps";
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
See also other code snippets for Android development using Java programming language here on ValueInBrief blog.