Universal image loader give error image can't be decoded android -
i use universal image loader in girdview. of videos fine change image , not work , give error that,
03-17 12:49:52.287: d/skia(21755): --- skimagedecoder::factory returned null 03-17 12:49:52.287: e/imageloader(21755): image can't decoded [file:////storage/sdcard0/movies/naruto episodes 55.mp4_270x270]
here code in main class.
displayimageoptions defaultoptions = new displayimageoptions.builder() .cacheondisc(true).cacheinmemory(true) .imagescaletype(imagescaletype.exactly) .displayer(new fadeinbitmapdisplayer(300)).build(); imageloaderconfiguration config = new imageloaderconfiguration.builder( getapplicationcontext()) .defaultdisplayimageoptions(defaultoptions) .memorycache(new weakmemorycache()) .disccachesize(100 * 1024 * 1024).build(); imageloader.getinstance().init(config);
here code in adpater,
string url = "/storage/sdcard0/movies/naruto episodes 55.mp4"; imageloader imageloader = imageloader.getinstance(); displayimageoptions options = new displayimageoptions.builder().cacheinmemory(true) .cacheondisc(true).resetviewbeforeloading(true) .showimageforemptyuri(r.drawable.x_document_icon) .showimageonfail(r.drawable.x_document_icon) .showimageonloading(r.drawable.x_document_icon).build(); //initialize image view //download , display image url imageloader.displayimage("file:///"+url, img_btn, options);
the following code work fine take time.
bitmap bitmap = thumbnailutils.createvideothumbnail(url, 0); img_btn.setimagebitmap(bitmap);
your file name contains spaces there issue posted in github. based on comments solution works though have not tried yet:
if (file.exists()) { final string uri = uri.fromfile(file).tostring(); final string decoded = uri.decode(uri); imageloader.getinstance().displayimage(decoded, imageview); }
as per comment should work:
string url = "/storage/sdcard0/movies/naruto episodes 55.mp4"; imageloader.displayimage("file:///"+uri.decode(url), img_btn, options);
Comments
Post a Comment