扩展片段出错

时间:2015-06-04 11:13:55

标签: android facebook login

我正在努力工作,但我不能。我想登录facebook,但我现在不知道。任何例子?

public class login extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,     Bundle saveStanceState){

    View view = inflater.inflate(R.layout.activity_login, container, false);

    loginButton = (LoginButton) view.findViewById(R.id.login_button);
    loginButton.setReadPermissions("user_friends");
    loginButton.setFragment(this);


    // Callback registration
    loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {

    });
    return inflater.inflate(R.layout.activity_login, container, false);
}

1 个答案:

答案 0 :(得分:0)

您的return用于新的View,您的代码应如下所示:

View view = inflater.inflate(R.layout.activity_login, container, false);
...
return view;