【问题标题】:Where Image gets stored in Android phone when i use Universal Image Loader library?当我使用通用图像加载器库时,图像在哪里存储在 Android 手机中?
【发布时间】:2015-02-16 06:18:43
【问题描述】:

我正在使用:

ImageLoader.getInstance().displayImage(imageUrls.get(position), holder.ivPhoto, options);

其中 imageUrls 是 String 的 ArrayList,它是加载图像的 urls 列表,并且 holder 包含 ImageView。

要分享此图像,我想使用此 Intent 但我不知道保存图像的位置。我已经在 Stack Overflow 上进行了搜索,但无法找到合适的解决方案,或者如果有任何其他方式可以分享非常有用的图像。

【问题讨论】:

    标签: android universal-image-loader instagram-api


    【解决方案1】:

    你可以从url下载图片

    public Bitmap getBitmapFromURL(String imageUrl) {
        try {
            URL url = new URL(imageUrl);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setDoInput(true);
            connection.connect();
            InputStream input = connection.getInputStream();
            Bitmap myBitmap = BitmapFactory.decodeStream(input);
            return myBitmap;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
    

    您可以添加自己的图像加载器类,例如:link 您将在构造函数中找到 DownImageLoader.java 类,创建一个缓存目录,您将在其中获取所有文件

    【讨论】:

      【解决方案2】:

      我认为您使用了错误的库。 UIL 库用于缓存图像。它不用于下载图像并将其存储在 sdcard 中。

      您可以参考此链接下载图像并检索图像路径。

      http://www.oodlestechnologies.com/blogs/Downloading-and-Retrieving-Files-on-SD-card-in-Android-using-Android-SDK-in-Eclipse

      【讨论】:

      • 不,我不这么认为,我的图片是从网址加载的...但我不知道在哪里
      猜你喜欢
      • 1970-01-01
      • 2014-12-06
      • 2014-11-13
      • 2012-10-17
      • 1970-01-01
      • 2019-01-28
      • 1970-01-01
      • 2012-07-11
      • 1970-01-01
      相关资源
      最近更新 更多