-1

I am unable to find the problem in this code.

I am trying to do Facebook Integration where login is successful but problem comes at sharing time. During share, the dialog box must take the mentioned text and the values of 4 textViews.

Source Code :

 pop.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() 
    {

     @Override
     public boolean onMenuItemClick(MenuItem item) {

     //Facebook Share

    if(item.getItemId()== R.id.facebook) {
             {
    ShareDialog shareDialog = new ShareDialog(MainActivity.this);

    if (ShareDialog.canShow(ShareLinkContent.class)) {

                  ShareLinkContent content = new ShareLinkContent.Builder(). setContentTitle("Test").
    setContentUrl(Uri.parse("http://developers.facebook.com/android")).
    setContentDescription(teamA.getText()+ scoreTeamA.getText()+ teamB.getText() + scoreTeamB.getText()).build();  
     shareDialog.show(content);
                                    }
                                }
                            }

From the Share Pop-up Menu, when I click on Facebook it shows the URL context but doesn't show the values of 2-Text Edits and 2-textViews.

Snippet: Code and Emulator Output

rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62
Aryan Sharma
  • 119
  • 1
  • 1
  • 11

2 Answers2

1

Try using: teamA.getText().toString() in setContentDescription()

setContentDescription(teamA.getText().toString()+ scoreTeamA.getText().toString()+ 
            teamB.getText().toString() + scoreTeamB.getText().toString())
rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62
0

Well, when you set Content URL, then facebook doesn't use any images and text or description you set, it actually scrap all the information from that URL and use that instead .. That's why it's happening ..

Hobbit
  • 601
  • 1
  • 9
  • 22