How to get avatar from VK API and transfer it as Bitmap to ImageView ?

  • 2
    what exactly does not work? to get a link to the avatar, or display an image via a link in the ImageView? - Vladyslav Matviienko

1 answer 1

Avatar - is the address of the image link. Get it with a network request to the API and feed it to the lib for downloading / displaying pictures - Picasso, Glide

Waiting for receiving a link to an image, you need to make a request according to the API description

For example: https://api.vk.com/method/users.get?user_ids=1&fields=photo_100&v=5.53

Request will return JSON of the form

 {"response":[{"id":1,"first_name":"Павел","last_name":"Дуров","photo_100":"http:\/\/cs629231.vk.me\/v629231001\/c542\/fcMCbfjDsv0.jpg"}]} 

In it lies the link.

Retrofit is best to get and parse

  • how to get the avatar address? - PirateNinja
  • @head, supplemented the answer - YuriySPb