Reputation: 1201
My app is some kind of dictionary app, when I search one word, it shows up the word itself, pronunciation, definition and button share to facebook. I want to know how to past that word to the facebook share message box.
Upvotes: 1
Views: 151
Reputation: 13588
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "YOUR TEXT HERE");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "YOUR TITLE HERE"));
You can use the above simple code to share it to any app installed in the user's phone.
If you specifically want to share it to Facebook, then you can add
sendIntent.setPackage("com.facebook.katana");
Upvotes: 1