java - Parse.com Android Images not showing on actual device. Shows on emulator -



java - Parse.com Android Images not showing on actual device. Shows on emulator -

i making app in android studio using parse sdk. when run device on emulator, works fine. on actual device, not show images. here's code:

public class imageloader { memorycache memorycache = new memorycache(); filecache filecache; private map<imageview, string> imageviews = collections .synchronizedmap(new weakhashmap<imageview, string>()); executorservice executorservice; // handler display images in ui thread handler handler = new handler(); public imageloader(context context) { filecache = new filecache(context); executorservice = executors.newfixedthreadpool(5); } final int stub_id = r.drawable.ic_launcher; public void displayimage(string url, imageview imageview) { imageviews.put(imageview, url); bitmap bitmap = memorycache.get(url); if (bitmap != null) imageview.setimagebitmap(bitmap); else { queuephoto(url, imageview); imageview.setimageresource(stub_id); } } private void queuephoto(string url, imageview imageview) { phototoload p = new phototoload(url, imageview); executorservice.submit(new photosloader(p)); } private bitmap getbitmap(string url) { final file f = filecache.getfile(url); bitmap b = decodefile(f); if (b != null) homecoming b; // download images net seek { bitmap bitmap = null; url imageurl = new url(url); httpurlconnection conn = (httpurlconnection) imageurl .openconnection(); conn.setconnecttimeout(30000); conn.setreadtimeout(30000); conn.setinstancefollowredirects(true); inputstream = conn.getinputstream(); outputstream os = new fileoutputstream(f); utils.copystream(is, os); os.close(); conn.disconnect(); bitmap = decodefile(f); homecoming bitmap; } grab (throwable ex) { ex.printstacktrace(); if (ex instanceof outofmemoryerror) memorycache.clear(); homecoming null; } } // decodes image , scales cut down memory consumption private bitmap decodefile(file f) { seek { // decode image size bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; fileinputstream stream1 = new fileinputstream(f); bitmapfactory.decodestream(stream1, null, o); stream1.close(); // find right scale value. should powerfulness of 2. final int required_size = 70; int width_tmp = o.outwidth, height_tmp = o.outheight; int scale = 1; while (true) { if (width_tmp / 2 < required_size || height_tmp / 2 < required_size) break; width_tmp /= 2; height_tmp /= 2; scale *= 2; } // decode insamplesize bitmapfactory.options o2 = new bitmapfactory.options(); o2.insamplesize = scale; fileinputstream stream2 = new fileinputstream(f); bitmap bitmap = bitmapfactory.decodestream(stream2, null, o2); stream2.close(); homecoming bitmap; } grab (filenotfoundexception e) { } grab (ioexception e) { e.printstacktrace(); } homecoming null; } // task queue private class phototoload { public string url; public imageview imageview; public phototoload(string u, imageview i) { url = u; imageview = i; } } class photosloader implements runnable { phototoload phototoload; photosloader(phototoload phototoload) { this.phototoload = phototoload; } @override public void run() { seek { if (imageviewreused(phototoload)) return; bitmap bmp = getbitmap(phototoload.url); memorycache.put(phototoload.url, bmp); if (imageviewreused(phototoload)) return; bitmapdisplayer bd = new bitmapdisplayer(bmp, phototoload); handler.post(bd); } grab (throwable th) { th.printstacktrace(); } } } boolean imageviewreused(phototoload phototoload) { string tag = imageviews.get(phototoload.imageview); if (tag == null || !tag.equals(phototoload.url)) homecoming true; homecoming false; } // used display bitmap in ui thread class bitmapdisplayer implements runnable { bitmap bitmap; phototoload phototoload; public bitmapdisplayer(bitmap b, phototoload p) { bitmap = b; phototoload = p; } public void run() { if (imageviewreused(phototoload)) return; if (bitmap != null) phototoload.imageview.setimagebitmap(bitmap); else phototoload.imageview.setimageresource(stub_id); } } public void clearcache() { memorycache.clear(); filecache.clear(); }

there exception show clue what's going on. java.io.filenotfoundexception: /storage/emulated/0/aggiesland/878582989: open failed: enoent (no such file or directory)

is there way show images on actual device?

edit: here logcat

06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ java.io.filenotfoundexception: /storage/emulated/0/aggiesland/878582989: open failed: enoent (no such file or directory) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ libcore.io.iobridge.open(iobridge.java:409) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.io.fileoutputstream.(fileoutputstream.java:88) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.io.fileoutputstream.(fileoutputstream.java:73) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ com.lbbw.aggiesland.aggiesland.app.imageloader.getbitmap(imageloader.java:78) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ com.lbbw.aggiesland.aggiesland.app.imageloader.access$000(imageloader.java:28) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ com.lbbw.aggiesland.aggiesland.app.imageloader$photosloader.run(imageloader.java:152) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.util.concurrent.executors$runnableadapter.call(executors.java:422) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.util.concurrent.futuretask.run(futuretask.java:237) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) 06-26 17:52:56.778 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.lang.thread.run(thread.java:841) 06-26 17:52:56.788 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ caused by: libcore.io.errnoexception: open failed: enoent (no such file or directory) 06-26 17:52:56.788 21588-22079/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ java.io.filenotfoundexception: /storage/emulated/0/aggiesland/-1260189210: open failed: enoent (no such file or directory) 06-26 17:52:56.788 21588-22079/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ libcore.io.iobridge.open(iobridge.java:409) 06-26 17:52:56.788 21588-22079/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.io.fileoutputstream.(fileoutputstream.java:88) 06-26 17:52:56.788 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ @ libcore.io.posix.open(native method) 06-26 17:52:56.788 21588-22079/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ java.io.fileoutputstream.(fileoutputstream.java:73) 06-26 17:52:56.788 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ libcore.io.blockguardos.open(blockguardos.java:110) 06-26 17:52:56.788 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ @ libcore.io.iobridge.open(iobridge.java:393) 06-26 17:52:56.788 21588-22075/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ ... 10 more 06-26 17:52:56.788 21588-22079/com.lbbw.aggiesland.aggiesland.app w/system.err﹕ com.lbbw.aggiesland.aggiesland.app.imageloader.getbitmap(imageloader.java:78)

java android parse.com

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -