Ich versuche, einige Daten auf meiner Android-Validierung mit Facebook API zu holen. Ich kann mich in meinen Facebook-Account einloggen. Dies ist die Erlaubnis, ich gesetzt haben Daten von Facebook-Account holenVerursacht von: java.lang.NullPointerException: Versuch, virtuelle Methode aufzurufen 'java.lang.String com.facebook.Profile.getFirstName()'
loginButton.setReadPermissions(Arrays.asList("public_profile", "email", "user_birthday", "user_friends"));
die obigen Berechtigungen mit I I Profilnamen und andere Daten zu holen versuche ich eine Null-Zeiger-Ausnahme mit dem folgenden Code-Schnipsel bekommen
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());
Bitte, was ist falsch mit dem Ansatz, den ich verwende.
Offensichtlich ** Profil ** ist ** ** null. – GhostCat