问题描述
请问ParseImageView缓存ParseFile在Android系统。如果缓存parseFile,我怎么能找到我的Android设备这些文件的路径。
ParseImageView的ImageView =(ParseImageView)findViewById(android.R.id.icon);
//占位符将之前和期间的获取,也可以通过所取出的图像替换使用
// 数据。
imageView.setPlaceholder(getResources()getDrawable(R.drawable.placeholder));
imageView.setParseFile(文件);
imageView.loadInBackground(新GetDataCallback(){
@覆盖
公共无效完成(byte []的数据,ParseException的E){
Log.i(ParseImageView
!取出的数据长度:+ data.length +,或异常:+ e.getMessage());
}
});
看起来像 @suresh库马尔是死没错,所以这个问题是解决与无,但已经遇到了这个麻烦,我想放弃一些code在这里解决了。
我用通用图像装载机的URL图像加载,它支持大量的配置选项高速缓存和显示。将它与你的应用程序类(在写作时):
//创建图像的选项。
DisplayImageOptions选项=新DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.button_default)
.cacheInMemory(真)
.cacheOnDisc(真)
。建立();
//创建这些选项的配置。
ImageLoaderConfiguration配置=新ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(选项)
。建立();
。ImageLoader.getInstance()的init(配置);
然后用它解析您希望加载和缓存图像:
ParseImageView itemImage =(ParseImageView)v.findViewById(R.id.iv_item);
ParseFile photoFile = item.getParseFile(图片);
如果(photoFile!= NULL){
//获取ImageLoader的的单一实例
ImageLoader的ImageLoader的= ImageLoader.getInstance();
//从网址到ImageView的加载图像。
imageLoader.displayImage(photoFile.getUrl(),itemImage);
}
希望有所帮助。
Does ParseImageView cache ParseFile's in Android. If it caches parseFile, How can i find the path of those files in my android device.
ParseImageView imageView = (ParseImageView) findViewById(android.R.id.icon);
// The placeholder will be used before and during the fetch, to be replaced by the fetched image
// data.
imageView.setPlaceholder(getResources().getDrawable(R.drawable.placeholder));
imageView.setParseFile(file);
imageView.loadInBackground(new GetDataCallback() {
@Override
public void done(byte[] data, ParseException e) {
Log.i("ParseImageView",
"Fetched! Data length: " + data.length + ", or exception: " + e.getMessage());
}
});
Looks like @suresh kumar is dead right, so this question is settled with "no", but having run into this trouble I wanted to drop some code in here to get around it.
I use Universal Image Loader for URL image loading, and it supports a lot of configuration options for caching and display. Set it up in your Application class with (at time of writing):
//Create image options.
DisplayImageOptions options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.button_default)
.cacheInMemory(true)
.cacheOnDisc(true)
.build();
//Create a config with those options.
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(options)
.build();
ImageLoader.getInstance().init(config);
And then use it with Parse where you'd like to load and cache your image:
ParseImageView itemImage = (ParseImageView) v.findViewById(R.id.iv_item);
ParseFile photoFile = item.getParseFile("picture");
if (photoFile != null) {
//Get singleton instance of ImageLoader
ImageLoader imageLoader = ImageLoader.getInstance();
//Load the image from the url into the ImageView.
imageLoader.displayImage(photoFile.getUrl(), itemImage);
}
Hope that helps.
这篇关于确实ParseImageView缓存ParseFile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!