Hardeep Singh Hardeep Singh - 1 year ago 196
Android Question

Android Facebook login without Facebook login button

I want login with facebook without using Facebook Login Button. so i applied click event on default android button.

But i got error

cannot resolve method logInWithReadPermissions(..)..

here is my code. Any help will appreciated

btnFBLogin.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile", "email"));// here giving error can not resolve method

Answer Source

You are currently passing reference of button

But you need to pass reference of Activity

Please use the below code that might help you.

LoginManager.getInstance().logInWithReadPermissions(LoginActivity.this, Arrays.asList("public_profile", "email"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download