Riy*_*yaz 4 android facebook android-layout android-activity
我正在开发Android应用程序,我正在使用Facebook SDK for android.
我想使用Facebook共享对话框:
ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("https://developers.facebook.com"))
.build();
Run Code Online (Sandbox Code Playgroud)
当我运行应用程序时没有任何反应,没有对话框出现 - 没有错误.
有人可以帮忙吗?
小智 5
首先初始化
FacebookSdk.sdkInitialize(getApplicationContext());
callbackManager = CallbackManager.Factory.create();
shareDialog = new ShareDialog(this);
Run Code Online (Sandbox Code Playgroud)
比秀
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("Hello Facebook")
.setContentDescription(
"The 'Hello Facebook' sample showcases simple Facebook integration")
.setContentUrl(Uri.parse("http://developers.facebook.com/android"))
.build();
shareDialog.show(linkContent);
}
Run Code Online (Sandbox Code Playgroud)
最后打个电话.
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
Run Code Online (Sandbox Code Playgroud)