Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Catching while showing images using ParseFile through parse.com

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 509
    Comment on it

    The problem that I encountered when showing images in ListView from Parse.com is catching because we get ParseFile from cloud.

     

    So I first change ParseFile to byte[] and then use Glide library that allow byte[] also to load image.
    Glide's primary focus is on making scrolling any kind of a list of images as smooth and fast as possible, but Glide is also effective for almost any case where you need to fetch, resize, and display a remote image.

    To implement Glide library, first of all add dependency in gradle file.

    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.android.support:support-v4:19.1.0'


    For dependency on proguard config, you need to add these lines in proguard.cfg

    -keep public class * implements com.bumptech.glide.module.GlideModule
    -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
      **[] $VALUES;
      public *;
    }   

     


    Below is the code to load ParseFile using Glide library

     parseFile.getDataInBackground(new GetDataCallback() {
                @Override
                public void done(byte[] data, ParseException e) {
                    Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
                    FlexLogger.createLog("Bitmap: " + bitmap);
                 
                    Glide.with(mContext).load(data).into(holder.challengeImage);
                 
    
                }
            });

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: