Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook for Android 3.0登录_Android_Facebook - Fatal编程技术网

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();
}