1

I am working on text sharing in all default available app like,facebook,gmail..etc.

Here I put snapshot of my code.

final Intent emailIntent1 = new Intent(
            android.content.Intent.ACTION_SEND);
    emailIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    emailIntent1.setAction("https://play.google.com/store");
    emailIntent1.putExtra(Intent.EXTRA_TEXT,"https://play.google.com/store");
    emailIntent1.setType("image/png");
    startActivity(Intent.createChooser(emailIntent1, "send"));

My problem is ,I can not share text in facebook.

Your answer would be appreciated.

Vasant
  • 3,475
  • 3
  • 19
  • 33

2 Answers2

2

Try this...

 Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("text/plain");
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Share this app");
        String shareMessage = "https://play.google.com/store";
        shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);
        startActivity(Intent.createChooser(shareIntent, "Choose the messenger to share this App"));
Parama Sudha
  • 2,583
  • 3
  • 29
  • 48
  • this one is what he wants I guess.. +1 – Abhishek Feb 01 '16 at 09:10
  • it works but only for text.but i also want share bitmap imageuri.i can't share text with bitmap image.emailIntent1.putExtra(Intent.EXTRA_STREAM, bmpUri); – Vasant Feb 01 '16 at 09:23
0

Try this code. It will create an Intent Chooser that list out all the installed app on the device that accept type "text/plain".

private void share(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"));
}
kopikaokao
  • 500
  • 7
  • 13