Facebookのログイン後にユーザー情報を取得しようとしています。ログイン後のAndroidのfacebook
callbackManager = CallbackManager.Factory.create();
loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setReadPermissions("user_birthday", "email");
final Context contextM = this.getApplicationContext();
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
String firstName = Profile.getCurrentProfile().getFirstName();
String lastName = Profile.getCurrentProfile().getLastName();
String url = Profile.getCurrentProfile().getProfilePictureUri(100, 100).toString();
final ImageView mImageView = (ImageView) findViewById(R.id.imageView);
ImageRequest request = new ImageRequest(url,
new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap bitmap) {
mImageView.setImageBitmap(bitmap);
}
}, 0, 0, null,
new Response.ErrorListener() {
public void onErrorResponse(VolleyError error) {
}
});
MySingleton.getInstance(contextM).addToRequestQueue(request);
}
、これは私が取得エラーです:
のjava.lang.NullPointerException:仮想メソッド を起動しようと 'はjava.lang.String型com.facebook.Profile.getFirstName()' にa null オブジェクトリファレンス
@Yura Abramovはあなたの問題を解決しましたか? – Nikhil
はいありがとう! –