2016-09-21 67 views
0

如何在點擊Facebook上分享內容時對動作分享活動進行編程。如何在Android上編寫共享活動的操作?

enter image description here

我創建Facebook的內容,但我不知道如何指示何時在Facebook上共享點擊。

enter image description here

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.setType("text/plain"); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Compartir"); 
sendIntent.putExtra(Intent.EXTRA_TEXT, "Descargar"); 
startActivity(sendIntent); 

private void shareFacebook(){ 

    shareDialog = new ShareDialog(this); 
    ShareLinkContent linkContent = new ShareLinkContent.Builder() 
      .setContentTitle("Hello Facebook") 
      .setContentDescription(
        "The 'Hello Facebook' sample showcases simple Facebook integration") 
     .setContentUrl(Uri.parse("http://developers.facebook.com/android")) 
      .setImageUrl(...) 
      .build(); 
    shareDialog.show(linkContent); 
} 

回答

0

我希望它能幫助

 Intent intent = new Intent(Intent.ACTION_SEND); 
    intent.setType("text/plain"); 
    intent.putExtra(Intent.EXTRA_TEXT, "http://developers.facebook.com/android"); 
    startActivity(Intent.createChooser(intent, "share")); 
相關問題