0

I try to implement share button in my android app to share in facebook The code:

facebook.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent share = new Intent(android.content.Intent.ACTION_SEND);
                share.setType("text/plain");
                share.putExtra(Intent.EXTRA_SUBJECT,desc.getText().toString());
                startActivity(Intent.createChooser(share, "Share description using"));


            }
        });

The problem is, in the post dialog of the facebook not display the text which i need to share from my app which it is (desc.getText().toString()) . There empty message !! why the text didn't appear !!!

Thanks in advance

Samah
  • 61
  • 1
  • 10
  • you cannot share only text on facebook by using share intent, you must have to use some link also. you can check this https://developers.facebook.com/bugs/332619626816423 – Ravi May 03 '16 at 13:21
  • 3
    Possible duplicate of [Share text via Intent on Facebook without using Facebook sdk](http://stackoverflow.com/questions/34618514/share-text-via-intent-on-facebook-without-using-facebook-sdk) – Devendra Singh May 03 '16 at 13:21
  • share link !!! do you mean link of my application ? – Samah May 03 '16 at 13:25
  • This code maybe help you! [link](http://stackoverflow.com/a/36910262/2996974) – DaoLQ May 03 '16 at 13:37

1 Answers1

0

Try with this. Hope it help

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "Share Something");
startActivity(Intent.createChooser(intent, "Share with"));
Masum
  • 4,879
  • 2
  • 23
  • 28