2013-11-23 58 views
13

ParseImageView緩存ParseFile在Android中。如果它緩存parseFile,我如何才能找到我的Android設備中的這些文件的路徑。確實ParseImageView緩存ParseFile

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()); 
    } 
}); 
+0

畢加索是去這裏的唯一途徑。 – Fattie

回答

2

ParseImageView不緩存ParseFile,它僅用於顯示存儲在Parse.com中的圖像文件。 See this

this

+0

Parse對去年的內容沒有更新。這很傷心。 – LordParsley

14

貌似@suresh kumar死了吧,所以這個問題是與解決「不」,但已經遇到這個麻煩,我想放棄在這裏的一些代碼來解決它。

我使用Universal Image Loader來加載URL圖像,並且它支持許多用於緩存和顯示的配置選項。把它架在你的應用程序類(在寫作時):

//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); 

然後用解析使用它,你想加載和緩存圖像:

 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); 
     } 

希望幫助。

+0

一個令人難以置信的小費,謝謝..只是FTR的iOS等價物是DLImageLoader(例如,http://stackoverflow.com/a/19115912/294884)......這可能有助於任何「Mac到Android」開發者在未來使用Google搜索。非常感謝。賞金途中! – Fattie

+1

很高興幫助! (有趣的是,iOS圖像加載器之間有多少競爭,我習慣使用SDWebImage。) – LordParsley

+0

**腳註** cacheOnDisc現在看起來像是cacheOnDisk(「k」)。 – Fattie