我在我的应用中使用Facebook Android SDK(3.19)并按照此链接https://developers.facebook.com/docs/android/like-button使用Like按钮。当我点击按钮时,会显示Like Dialog并立即被解雇。此外,未调用onActivityResult。我不知道为什么。请有人帮我解决这个问题。感谢。
编辑:我的代码
public class ContentFragment extends Fragment{
LikeView likeView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
Settings.sdkInitialize(getActivity());
Settings.setPlatformCompatibilityEnabled(false);
Settings.setIsDebugEnabled(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_fragment, null);
likeView = (LikeView) view.findViewById(R.id.like_view);
likeView.setObjectId("http://shareitexampleapp.parseapp.com/photo1/");
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
LikeView.handleOnActivityResult(getActivity(), requestCode, resultCode, data);
Toast.makeText(getActivity(), "onActivityResult", Toast.LENGTH_SHORT).show();
}
}
Edit2:已关闭。这是我的错。我的测试帐户未添加到我的Facebook应用程序的测试人员中。感谢。