android - Why doesn't ImageView load my image? -


i'm new android development forgive lack of knowledge on this. i'm trying make app finds image stored in internal memory , displays in imageview. i've gone through multiple ways image never displayed.

here's code far:

public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_main);      tv = (textview)findviewbyid(r.id.textview);      iv = (imageview)findviewbyid(r.id.frontimage);     bv = (imageview)findviewbyid(r.id.backimage);     bitmap mybitmap;     file imgfile = new  file(path,"front1.png");     //check if image exists     if(imgfile.exists())     {               //get image             mybitmap = bitmapfactory.decodefile(imgfile.getabsolutepath());             iv.setimagebitmap(mybitmap); //add image imageview             tv.settext(imgfile.getabsolutepath());     }             } 

i think textview tv displays correct path image doesn't load. can me this?

you need add read permission in manifest, other wise mybitmap null.

<uses-permission android:name="android.permission.read_external_storage" /> 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -