android - ImageView won't show image when set by setImageBitmap() -


i having problems getting existing image on sdcard display.

imageview _photoview = (imageview)findviewbyid(r.id.img_photo);  file photofile = new file(environment.getexternalstoragedirectory(), session.photo_file_name); rawfileinputstream = new fileinputstream(photofile); bitmap origphoto = bitmapfactory.decodestream(rawfileinputstream, null, new bitmapfactory.options());  _photoview.setimagebitmap(origphoto); log.d(tag, origphoto.getwidth() + " - " + origphoto.getheight()); 

the photo exist , dimensions show displayed, nothing appears within imageview tag

<imageview      android:id="@+id/img_photo"     android:layout_width="fill_parent"     android:layout_height="wrap_content" /> 

i tried set height fixed size, still can't see photo.

i've seen few posts on regarding issue, none of them have yet been answered.

any ideas?

** update if load file directly, instead of through filestream works

bitmap origphoto = bitmapfactory.decodefile("/mnt/sdcard/" + session.photo_file_name); double scale = max_width * 1.0 / origphoto.getwidth(); int height = (int)(origphoto.getheight() * scale); bitmap scaledphoto = bitmap.createscaledbitmap(origphoto, max_width, height, true); _photoview.setimagebitmap(origphoto); 

but if add bitmap.createscaledbitmap() method call no longer works , image not displayed.

i replaced file streaming bitmap scaledphoto = bitmapfactory.decodefile("/mnt/sdcard/" + session.photo_file_name); , works (what mentioned in update)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -