Android Universal Image Loader store downloaded progress listview -
i using universal image loader in listview. problem following usecase:
when scroll on listview,it works perfectly, , load images. lets suppose, have 2 items on screen in listview, in download progress. can see it's progress imageloadingprogresslistener()
, scroll anywhere , come same images, progress starts again, downloaded data lost!! there way store downloaded progress can resume process later when come image in listview.
edit: can cache images once downloaded, , able use cached image, problem time when thay being downloaded , scroll , come back.
my displayimageoptions
:
options = new displayimageoptions.builder() .displayer(new roundedbitmapdisplayer(100)) .cacheinmemory(true) .cacheondisk(true) .considerexifparams(true) .bitmapconfig(bitmap.config.rgb_565) .build();
my imageloaderconfiguration
:
new imageloaderconfiguration.builder(context) .threadpriority(thread.norm_priority - 2) .denycacheimagemultiplesizesinmemory() .diskcachefilenamegenerator(new md5filenamegenerator()) .diskcachesize(50 * 1024 * 1024) // 50 mb .tasksprocessingorder(queueprocessingtype.lifo) .writedebuglogs() // remove release app .build();
my getview()
:
@override public view getview(int position, view convertview, viewgroup parent) { viewholder holder; if(convertview == null){ convertview = inflater.inflate(r.layout.card, parent,false); holder = new viewholder(); holder.ivcontent = (imageview) convertview.findviewbyid(r.id.ivcontent); convertview.settag(holder); } else{ holder = (viewholder) convertview.gettag(); } try { imageloader.getinstance().displayimage(url, holder.ivcontent, options, new simpleimageloadinglistener(){ @override public void onloadingcomplete(string imageuri, view view,bitmap loadedimage){ holder.ivcontent.setvisibility(view.visible); } }, new imageloadingprogresslistener() { @override public void onprogressupdate(string arg0, view arg1, int count, int total) { system.out.println("prog: "+(count*100)/total); //holder.ivloaderup.setclipping((count*100)/total); } }); } catch (parseexception e) { e.printstacktrace(); } return convertview; }
has run problem, please help.
you can found answer why loadings started again - here. uil abort downloading if there loaded less 75% of image data. if want change should change sources of ioutil
class. change constant from:
public static final int continue_loading_percentage = 75;
to
public static final int continue_loading_percentage = 0;
Comments
Post a Comment