android - ImageView not changing image when source is changed (already using invalidate) -


i have imageview set image in xml. when try change image imageview never displays second image. instead displays blank screen. have tried code , without invalidate() , there no change.

imageview image; string imgpath=environment.getexternalstoragedirectory()+"/music/evanescence - discography - 1998-2011 (320 kbps)/album's/2000 origin (limited edition) (320 kbps)/scans covers/06.jpg";  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     image=(imageview)findviewbyid(r.id.imageview1);      image.setimagebitmap(bitmapfactory.decodefile(imgpath));     if(!new file(imgpath).exists())         log.i("aaa","file doesnt exist");     //select image gallery     //intent photopickerintent = new intent(intent.action_pick);     //photopickerintent.settype("image/*");     //startactivityforresult(photopickerintent, select_photo);      log.i("aaa","done. img path: "+imgpath); } 

i think image large.

on devices, instead of java.lang.outofmemoryerror being thrown, null bitmap returned.

try running code smaller image. if works, have learn how display bitmaps properly in android.

(well either way have to)


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -