List or number of followers (knowing his id)? List or number of friends of the user?

I know how to get my friends, what should I add?

VKRequest request = VKApi.friends().get(VKParameters.from(VKApiConst.FIELDS, "first_name", "last_name")); 
  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky

1 answer 1

To get the number of followers of a user, make a request like this:

 final VKRequest request = VKApi.users().getFollowers(VKParameters.from(VKApiConst.USER_ID, 66748, VKApiConst.COUNT, 1000)); 

In this query, instead of "66748" enter the desired user ID. In the field "COUNT" indicate the number of subscribers, information about which you want to get.

We process the received answer so:

 try { JSONObject r = response.json.getJSONObject("response"); System.out.println("Подписчиков у пользователя с id 66748: " + r.getString("count")); } catch (JSONException e) { e.printStackTrace(); } 

In the console you will be displayed:

I / System.out: Followers with id 66748: 39261