How do you load the VC avatar in `ImageView'?



  • Requesting:

    VKRequest userphoto = VKApi.users().get(VKParameters.from(VKApiConst.FIELDS, "photo_100"));
    

    We've got to load it up. ImageView



  • Supposing the next option on the basis of https://github.com/rokhlin/vk1000 : There's a PicassoCache class:

    public class PicassoCache {
    

    private static Picasso picassoInstance = null;

    private PicassoCache (Context context) {

    Downloader downloader   = new OkHttpDownloader(context, Integer.MAX_VALUE);
    Picasso.Builder builder = new Picasso.Builder(context);
    builder.downloader(downloader);
    
    picassoInstance = builder.build();
    

    public static Picasso getPicassoInstance (Context context) {

    if (picassoInstance == null) {
    
        new PicassoCache(context);
        return picassoInstance;
    }
    
    return picassoInstance;
    

    }
    }

    ImageView is used in this example in fragment_user.xml:

    <ImageView
    style="@style/avatar"
    android:id="@+id/iv_user_avatar" />

    ID iv_user_avatar Here we go. LoadUserFragment.javawhere we're looking for our wine:

    avatar = (ImageView)view.findViewById(R.id.iv_user_avatar);

    Further use:

    PicassoCache.getPicassoInstance(getContext()).load(curUser.getPhoto50()).into(avatar);

    Explains in general terms. I think it should tell you where to find the answer.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2