gpt4 book ai didi

android - Facebook 点赞按钮显示空白弹出窗口并且在 Android 应用程序上不返回任何内容

转载 作者:行者123 更新时间:2023-11-29 01:36:51 24 4
gpt4 key购买 nike

我开发了一个 android 应用程序,它使用来自 android like 按钮的 Facebook SDK 具有 Facebook like 按钮。但是当我们点击喜欢按钮时,它会显示空白弹出窗口并返回屏幕。也喜欢是行不通的。

下面是代码。

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Settings.sdkInitialize(this);

uiHelper = new UiLifecycleHelper(this, null);
uiHelper.onCreate(savedInstanceState);

likeView = (LikeView) findViewById(R.id.like_view);
likeView.setObjectId("https://www.facebook.com/VehicleDocs");

likeView.setLikeViewStyle(LikeView.Style.BUTTON);
likeView.setAuxiliaryViewPosition(LikeView.AuxiliaryViewPosition.INLINE);
likeView.setHorizontalAlignment(LikeView.HorizontalAlignment.CENTER);

share = (Button)findViewById(R.id.share);
share.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(MainActivity.this)
.setLink("https://www.facebook.com/rkvb")
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());

}
});
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
// uiHelper.onActivityResult(requestCode, resultCode, data, null);
// if you don't use the UiLifecycleHelper, call handleOnActivityResult on the LikeView instead
// LikeView.handleOnActivityResult(this, requestCode, resultCode, data);
// Log.i("count", "OnActivityResult...");


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.i("Activity", "Success!");
}
});
}

activity_main.xml

 <com.facebook.widget.LikeView
android:id="@+id/like_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

android:layout_below="@+id/textView1"
android:layout_marginTop="116dp"

>
</com.facebook.widget.LikeView>

最佳答案

您是否使用 FB 测试用户帐户登录您的应用程序?不允许测试帐户喜欢页面。我有同样的问题。我改为使用我的实际 FB 帐户登录,LikeButton 工作得很好!

关于android - Facebook 点赞按钮显示空白弹出窗口并且在 Android 应用程序上不返回任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27422174/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com