我正在使用facebook defaul对话框在我的Facebook墙上分享帖子。我的代码如下。
facebook.dialog(this, "feed", new DialogListener() {
@Override
public void onFacebookError(FacebookError e) {
}
@Override
public void onError(DialogError e) {
}
@Override
public void onComplete(Bundle values) {
}
@Override
public void onCancel() {
}
});
但是现在我正在添加一个TextView和一个Button,点击按钮后,textView文本将发布在我的Facebook墙上。
答案 0 :(得分:1)
在 DialogListener 中覆盖 onComplete(),然后执行您想要的操作或使用textview中的 getText 获取值并发布。< / p>
public void onComplete(Bundle values) {
mProgress.setMessage("Posting ...");
mProgress.show();
AsyncFacebookRunner mAsyncFbRunner = new AsyncFacebookRunner(mFacebook);
Bundle params = new Bundle();
params.putString("message", "A Game Developed By Me !");
params.putString("name", "Match Maker");
params.putString("caption", "www.labmimosa.com/");
params.putString("link", "https://play.google.com/store/apps/details?id=com.reverie.fushh");
params.putString("description", "Dexter: Blood. Sometimes it sets my teeth on edge, other times it helps me control the chaos.");
params.putString("picture", "http://twitpic.com/show/thumb/6hqd44");
//params.putByteArray("picture", bitMapData);
mAsyncFbRunner.request("me/feed", params, "POST", new WallPostListener());
}
Wallpostlistener类是
private final class WallPostListener extends BaseRequestListener {
public void onComplete(final String response) {
mRunOnUi.post(new Runnable() {
@Override
public void run() {
mProgress.cancel();
Toast.makeText(Exp_Fb_Twt_Activity.this, "Posted to Facebook", Toast.LENGTH_SHORT).show();
}
});
}
}