【问题标题】:Load images from byte array into the gridview将字节数组中的图像加载到gridview中
【发布时间】:2014-07-31 03:51:49
【问题描述】:

我正在使用 UniversalImageLoader 库将图像加载到 GridView 中。 而且我有字节数组形式的图像。

如何将 UniversalImageLoader 与字节数组的 ArrayList 一起使用

我正在从我的 SQlite 数据库中获取字节数组。

【问题讨论】:

  • 我建议你使用Android Query,它是加载图片的完美解决方案。
  • 它被否决的任何原因! UIL 以 uri 作为论据。有没有机会使用字节数组
  • 看这里 - stackoverflow.com/questions/16231489/… 也许有帮助。

标签: android universal-image-loader


【解决方案1】:

试试这个方法,使用字节数组对象传递这个方法和位图arraylist在存储位图,并传递CustomGridViewAdapter在适配器中传递这个数组列表,并在imageview中设置位图

void setImage2(byte[] byteImage2) {

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inDither = false;
        options.inJustDecodeBounds = false;
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
        options.inSampleSize = 1;
        options.inPurgeable = true;
        options.inPreferQualityOverSpeed = true;
        options.inTempStorage = new byte[32 * 1024];
        Bitmap bmp = BitmapFactory.decodeByteArray(byteImage2, 0,
                byteImage2.length, options); // this bitmap store in Bitmap ArrayList in add


    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-27
    • 2015-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-28
    相关资源
    最近更新 更多