在我的片段中,我有一个包含以下内容的OnactiviyResult:
uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() {
@Override
public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) {
Log.e("Activity", String.format("Error: %s", error.toString()));
}
@Override
public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
Log.d("Activity", "Success!");
boolean isComplete = FacebookDialog.getNativeDialogDidComplete(data);
String postId = FacebookDialog.getNativeDialogPostId(data);
if (isComplete) {
String completionGesture = FacebookDialog.getNativeDialogCompletionGesture(data);
if (completionGesture == null || FacebookDialog.COMPLETION_GESTURE_CANCEL.equals(completionGesture)) {
//Show Publish Cancel Toast
Toast.makeText(getActivity(), "User canceled facebook post", Toast.LENGTH_SHORT).show();
} else {
if (postId != null) {
Toast.makeText(getActivity(), "user published", Toast.LENGTH_SHORT).show();
try {
ParseObject game = new ParseObject("Deal");
game.put("User", user_ID);
game.save();
} catch (ParseException e) {
e.printStackTrace();
} finally {
Toast.makeText(getActivity(), "got" + user_ID, Toast.LENGTH_SHORT).show();
}
}
}
}
}
});
它永远无法解决的问题。没有任何回报。 这样称呼它:
uiHelper.trackPendingDialogCall(shareDialogBuilder.build().present());
现在我发现它正在发生,因为这个问题中的片段: Facebook Intent share doesnt show Activity result on share click
他说"我所做的只是将这些代码导出到我的MainActivity" 究竟应该怎么样? 感谢
答案 0 :(得分:1)
你需要做
shareFacebookDialog.setFragment(this);
其中"这个"是片段
获取片段中的回调
当你在onActivityResult
中得到结果时你可能需要做resultCode&0xffff
因为一些Android版本有这个错误,并改变了请求代码而没有将其转回