I was able to implement the the facebook login using the code :
public class MainActivity extends ActionBarActivity implements FacebookCallback<LoginResult> {
//List<String> permissionNeeds=Arrays.asList("user_photos","friends_photos", "email", "user_birthday", "user_friends");
TextView t;
String get_id, get_name, get_gender, get_email, get_birthday, get_locale, get_location;
private CallbackManager mCallbackManager;
private LoginButton mFbLoginButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//init facebook sdk and
FacebookSdk.sdkInitialize(getApplicationContext());
setContentView(R.layout.activity_main);
//instantiate callbacks manager
mCallbackManager = CallbackManager.Factory.create();
mFbLoginButton=(LoginButton)findViewById(R.id.login_button);
mFbLoginButton.registerCallback(mCallbackManager, this);
mFbLoginButton.setReadPermissions(Arrays.asList("user_status","email"));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//manage login result
mCallbackManager.onActivityResult(requestCode, resultCode, data);
}
public void onSuccess(LoginResult loginResults) {
Toast.makeText(getApplicationContext(), "Success ",
Toast.LENGTH_LONG).show();
}
public void onCancel() {
}
public void onError(FacebookException e) {
}
}
Now how can I get the user details such as name , email ,age ,etc .I have searched the web for a few examples but i was unsuccessful.Where am i supposed to put the code for it ?
To do this you can use this.
And to use this just call getuserdata() in your on create for example.