Android 无法在TabHost内登录并在facebook上共享
我在我的项目中使用Facebook SDK版本3.5.2。我有一个有三个标签的TabHost,我在其中一个上使用Facebook共享。我正在使用WebDialog进行共享,但当我单击“共享”按钮时,它只会打开一个空白活动,并在2-3秒后自动关闭 以下是使用Facebook共享的活动代码Android 无法在TabHost内登录并在facebook上共享,android,facebook,Android,Facebook,我在我的项目中使用Facebook SDK版本3.5.2。我有一个有三个标签的TabHost,我在其中一个上使用Facebook共享。我正在使用WebDialog进行共享,但当我单击“共享”按钮时,它只会打开一个空白活动,并在2-3秒后自动关闭 以下是使用Facebook共享的活动代码 private void publishFeedDialog() { Session.openActiveSession(More.this.getParent(), true,
private void publishFeedDialog() {
Session.openActiveSession(More.this.getParent(), true,
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
// TODO Auto-generated method stub
if (session.isOpened()
&& !session.getPermissions().contains(
"publish_actions")) {
session.requestNewPublishPermissions(new NewPermissionsRequest(
More.this.getParent(), "publish_actions"));
Bundle params = new Bundle();
/*
* params.putString("name", titleString);
* params.putString("caption", addressString);
* params.putString("description",
* descriptionString);
*/
params.putString("caption", msgString);
// params.putString("link", linkString);
params.putString("picture",
"live_image_path/logo.jpg");
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(
More.this.getParent(), Session
.getActiveSession(), params))
.setOnCompleteListener(
new OnCompleteListener() {
@Override
public void onComplete(
Bundle values,
FacebookException error) {
if (error == null) {
// When the story is
// posted, echo the
// success
// and the post Id.
final String postId = values
.getString("post_id");
if (postId != null) {
/*
* Toast.makeText(
* More.this,
* "Posted story, id: "
* + postId,
* Toast.LENGTH_SHORT
* ) .show();
*/
} else {
// User clicked the
// Cancel button
Toast.makeText(
More.this,
"Publish cancelled",
Toast.LENGTH_SHORT)
.show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x"
// button
Toast.makeText(
More.this
.getParent(),
"Publish cancelled",
Toast.LENGTH_SHORT)
.show();
} else {
// Generic, ex: network
// error
Toast.makeText(
More.this
.getParent(),
"Error posting story",
Toast.LENGTH_SHORT)
.show();
}
}
}).build();
feedDialog.show();
}
}
});
}