sharing a link on facebook wall in android
can anyone please help me to understand how to share a link on facebook wall??
public class SampleDialogListener extends BaseDialogListener {
public void onComplete开发者_JS百科(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");
}
}
}
i m getting a null value of post_id..
You can achieve this using the following code
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);
For sharing of message just add one more param as:
params.putString("caption", "Test Photo");
精彩评论