Facebook for Android 3.0登录
我完成了,并成功地实现了登录和注销流程。但是,这适用于内置的登录按钮:Facebook for Android 3.0登录,android,facebook,Android,Facebook,我完成了,并成功地实现了登录和注销流程。但是,这适用于内置的登录按钮: <com.facebook.widget.LoginButton android:id="@+id/authButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"
<com.facebook.widget.LoginButton
android:id="@+id/authButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
/>
当用户从列表中选择一个项目时,会出现一个带有共享选项的自定义对话框。当用户选择此股票期权时,我想将他们登录到facebook,像ABC想访问你的个人资料、ABC想向你的朋友发帖等
编辑:
我想我已经找到了,但我很早就遇到了一个问题。我无法导入facebook对话框
。它既不提供给我,也不能在导入com.facebook.*时使用代码>
根据facebook对话框
位于com.facebook.widget
包中。但是,当我键入导入com.facebook.widget
时。提供的唯一对话框是WebDialog
我需要的是
例如:
private void publishFeedDialog() {
Bundle params = new Bundle();
params.putString("name", "New level!");
params.putString("description", "I have reached level " + lvel!");
params.putString("link", "https://play.google.com/store/apps/details?id=com.myapp");
params.putString("picture", "http://myapp.com/Images/icoon.png");
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(this,
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(getActivity(), "Posted story, id: "+postId, Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
//Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
//Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(getApplicationContext(),
"Error sharing app", Toast.LENGTH_SHORT).show();
}
}
})
.build();
feedDialog.show();
}