I am trying to fetch some data on my android validation using Facebook API. I am able to login into my facebook account. This is the permission I have set to fetch data from Facebook account
loginButton.setReadPermissions(Arrays.asList( "public_profile", "email", "user_birthday", "user_friends"));
using the above permissions I am trying to fetch profile name and other data I am getting a null pointer exception with the below code snippet
public void getFacebookData(AccessToken accessToken, Profile profile) {
System.out.println("---------------------");
System.out.println("--Facebook Login Successful!");
System.out.println("--Logged in user Details : ");
System.out.println("---------------------");
System.out.println("--User ID : " + accessToken.getUserId());
System.out.println("--Authentication Token : " + accessToken.getToken());
System.out.println("---------------------");
System.out.println("--First Name : " + profile.getFirstName());
System.out.println("--Last Name : " + profile.getLastName());
System.out.println("--URL Perfil: " + profile.getLinkUri());
System.out.println("--URL Imagem: " + profile.getProfilePictureUri(500, 500));
System.out.println("---------------------");
System.out.println("--ID : " + profile.getId());
System.out.println("--Name : " + profile.getName());
System.out.println("---------------------");
TextView profile_name = (TextView)findViewById(R.id.profile);
profile_name.setText(profile.getName());
Please, what be wrong with the approach I am using.