When i want to get profile pic in contact screen. then i get null pointer error in user

86 views Asked by At

When I get blob id after using this code...

QBUser user = null;
int userProfilePictureID = user.getFileId(); // user - an instance of QBUser class

QBContent.downloadFileTask(userProfilePictureID, new QBEntityCallbackImpl<InputStream>(){

      @Override public void onSuccess(InputStream inputStream, Bundle
      params) {

      }

      @Override public void onError(List<String> errors) {

      }}, new QBProgressCallback() {
      @Override public void onProgressUpdate(int progress) {

      } 
 });

Then I get null pointer error. in this line...

 int userProfilePictureID = user.getFileId(); 

I don't understand how to get user.

1

There are 1 answers

0
Rubycon On BEST ANSWER

You initialised user as null

QBUser user = null;

that's why you get NPE

Try to use Users sample to understand how to obtain users

http://quickblox.com/developers/SimpleSample-users-android