从Parse.com保存在外部存储图像 [英] Save images in external storage from Parse.com

查看:110
本文介绍了从Parse.com保存在外部存储图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从解析数据库表下载图像并存储在外部存储器中的文件夹的所有图像。可能吗 ?如果是,如何?

I want to download images from parse database table and store all the images in a external memory folder. Is it possible ? If yes , how ??

推荐答案

是的,当然是可以的。但是,你需要遵循一些步骤:

Yes of course it is possible. But you need to follow some steps:

- 开始从您解析对象下载图片网址:

-Start downloading the image Url from your Parse object:

String url=yourParseObject.getParseFile("Image").getUrl();

- 现在通过这个URL此功能:

-Now pass that url to this function:

public static Drawable loadImageFromUrl(String url) {
        InputStream inputStream;
        final ImageView imageView = (ImageView) rowView.findViewById(R.id.image);//Your imageView in the layout 
        AsyncImageLoader async=new AsyncImageLoader();

        Drawable cachedImage = async.loadDrawable(
                url, new ImageCallback() {
                    public void imageLoaded(Drawable imageDrawable,
                            String imageUrl) {
                        imageView.setImageDrawable(imageDrawable);
                    }
                });
        imageView.setImageDrawable(cachedImage);
        return cachedImage;
    }

- 如果要保存在SD卡,而不是ImageView的出口里面的绘制或位图形式方法(可绘制imageDrawable,字符串图片网址)。

-If you want to save that in SD Card instead of ImageView, export that inside of the method (Drawable imageDrawable,String imageUrl) in drawable or bitmap form.

希望它帮助!

这篇关于从Parse.com保存在外部存储图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆