The problem is that VKList is empty all the time (NullPointerException). VK documentation says that the photos.getAll command should return a list of photo objects

  `VKRequest request = new VKRequest("photos.getAll", VKParameters.from(VKApiConst.OWNER_ID, 1)); request.executeWithListener(new VKRequest.VKRequestListener() { @Override public void onComplete(VKResponse response) { super.onComplete(response); VKList list = (VKList) response.parsedModel; Toast.makeText(MainActivity.this, "Кол-во фоток: "+ list.size(), Toast.LENGTH_SHORT).show(); } });` 

How to solve this problem

    2 answers 2

    It was necessary to specify the parent class of the VKPhotoArray.class array;

     VKRequest request = new VKRequest("photos.getAll", VKParameters.from(VKApiConst.OWNER_ID, 1), VKPhotoArray.class); 

      First of all, check that you have connected the rights "PHOTOS". Also, you need to see if you specified Owned_id correctly (user or community id, from which you need to take all the photos). Your code is 1 - this is not correct.

      • Rights to the photo are - private String[] scope = {VKScope.FRIENDS, VKScope.PHOTOS}; and owner_id = 1 is Pavel Durov’s id, for example he put in - alexander.android.dev
      • But in general, the connection occurs to Vkontakte, get a token? And I would still try, owner_id to put some more real, for example, my own. - strevg
      • Yes, I tried the other owner_id. I get a list of friends. But with photos of trouble - alexander.android.dev