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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -