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(.
Solution 1:
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"));
Solution 2:
Use the
LoginActivity.this// name of the activity and `.this`instead of this in Button onClick() function. If you using this in this case it means you referring to the Button not the Activity.
Because this refers to the subsequent parent which is in this case Button.
If you use the same code in onCreate() method (not in any click listener etc.) that's fine Because in that case this refers to the activity.
Post a Comment for "Android Facebook Login Without Facebook Login Button"