android - imageView.setImageBitmap(bitmap) allways null while bitmap not null -
i pass string photo path activity, convert uri (because photo path converted uri), made inputstream uri, , made bitmap inputstream. bitmap created , not null, when call imageview.setimagebitmap(bitmap)
, system give error that:
void android.widget.imageview.setimageuri(android.net.uri)' on null object reference.
private void showimage(uri mpath) { photopath=mpath.tostring(); inputstream = null; try { = getcontentresolver().openinputstream(mpath); bitmap bitmap = bitmapfactory.decodestream(is); is.close(); photo.setimageuri(mpath); } catch (filenotfoundexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } }
what problem met, please me ! thank you
it sounds imageview null. resolving problem fix error.
Comments
Post a Comment