我做了一个小例子,通过 Android 应用程序向 facebook 提要发布消息。效果很好,但我只想在帖子中添加更多内容,例如 Facebook 页面的图标、链接和更多内容。
我怎样才能将这些参数添加到我的 facebook 对话框中以发布它们?
public class MainActivity extends Activity
{
Facebook facebook = new Facebook("Here i got my app id.");
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Posting my message, maybe here i could add paramterers like icon and a link etc..?
facebook.dialog(MainActivity.this, "feed", new PostDialogListener());
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
}
public abstract class BaseDialogListener implements DialogListener {
@Override
public void onFacebookError(FacebookError e) {
e.printStackTrace();
}
@Override
public void onError(DialogError e) {
e.printStackTrace();
}
@Override
public void onCancel() {
}
}
public class PostDialogListener extends BaseDialogListener {
@Override
public void onComplete(Bundle values) {
final String postId = values.getString("post_id");
if (postId != null) {
ki("Message posted on the wall.");
} else {
ki("No message posted on the wall.");
}
}
}
}