0

I'm using Android Studio. I've downloaded VK SDK from github and added it in my project file.Also I import it

import com.perm.kate.api.Api;

I authorize, then get my friends with it

Api api = new Api(Account.access_token, Constants.API_ID);
users = api.getFriends(Account.user_id, "photo", null, null, null);

Insert them in DB

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(c);
    SharedPreferences.Editor editor = prefs.edit();
       for(int i =0; i< users.size();++i){
                editor.putString("FriendFirstName" + String.valueOf(i), users.get(i).first_name);
                editor.putString("FriendLastName"+ String.valueOf(i), users.get(i).last_name);
                editor.putString("FriendPhoto"+ String.valueOf(i), users.get(i).photo);
           }
    editor.commit();

After, I can get any of my friend's name and it's working fine:

 Names.add(prefs.getString("FriendFirstName" + String.valueOf(i), null)
        +" "+prefs.getString("FriendLastName" + String.valueOf(i), null) );

BUT whenever I try get the photo or photo_medium_rec or any kind of photo it gives me null

 Toast.makeText(getActivity(),String.valueOf(prefs.getString("FriendPhoto0", null))
                ,Toast.LENGTH_LONG).show();//NULL

Why is it giving null?

Addition

I'm new in programming, so here are some of my dumb questions about VK SDK. What should I use Api or Request methods like this:

VKRequest request = VKApi.uploadWallPhotoRequest(new VKUploadImage(photo, VKImageParameters.jpgImage(0.9f)), 0, 0);

Is there any difference between them? How to use Request? And how get my personal user information? I couldn't fined any methods in Api to get it.

Zhambulable
  • 1,083
  • 2
  • 10
  • 17

1 Answers1

0

Try to use official VK SDK (link). And maybe it will be helpfull (link)

DeniSHow
  • 1,394
  • 1
  • 18
  • 30