I am using SDK version 3.5.2 in my project. I have a TabHost with three tabs, and I use Facebook Share on one of them. I use WebDialog for sharing, but when I click the "Share" button, it just opens a blank action and closes after 2-3 seconds.
Here is the action code that uses Facebook Share
private void publishFeedDialog() {
Session.openActiveSession(More.this.getParent(), true,
new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (session.isOpened()
&& !session.getPermissions().contains(
"publish_actions")) {
session.requestNewPublishPermissions(new NewPermissionsRequest(
More.this.getParent(), "publish_actions"));
Bundle params = new Bundle();
params.putString("caption", msgString);
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) {
final String postId = values
.getString("post_id");
if (postId != null) {
} else {
Toast.makeText(
More.this,
"Publish cancelled",
Toast.LENGTH_SHORT)
.show();
}
} else if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(
More.this
.getParent(),
"Publish cancelled",
Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(
More.this
.getParent(),
"Error posting story",
Toast.LENGTH_SHORT)
.show();
}
}
}).build();
feedDialog.show();
}
}
});
}
source
share