2011-09-06 142 views
1

任何人都可以請幫我理解如何在facebook牆上分享鏈接?分享在facebook壁上的鏈接android

公共類SampleDialogListener擴展BaseDialogListener {

 public void onComplete(Bundle values) { 
      final String postId = values.getString("post_id");/////// 
      Log.d("Facebook-Example", "Dialog Success! post_id=" + postId); 

      if (postId != null) { 
       Log.d("Facebook-Example", "Dialog Success! post_id=" + postId); 
       mAsyncRunner.request(postId, new WallPostRequestListener()); 
       mDeleteButton.setOnClickListener(new OnClickListener() { 
        public void onClick(View v) { 
         mAsyncRunner.request(postId, new Bundle(), "DELETE", 
           new WallPostDeleteListener(), null); 
        } 
       }); 
       mDeleteButton.setVisibility(View.VISIBLE); 
      } else { 
       Log.d("Facebook-Example", "No wall post made"); 
      } 
     } 
    } 

即時得到POST_ID的空值..

回答

1

你可以做到這一點使用下面的代碼

Bundle parameters = new Bundle(); 
parameters.putString("message", "Test Photo"); 
parameters.putString("attachment", "{\"name\":\"My Test link\"," 
+"\"href\":\""+"http://www.google.com"+"\"}"); 
facebookClient.dialog(this, "stream.publish", parameters, this); 
+0

感謝您的解決方案....「我的測試鏈接」是共享的,但消息「測試照片」仍然沒有分享.....任何人都可以請幫忙... –

0

對於信息共享只是添加一個參數爲:

params.putString("caption", "Test Photo");