android - setImageViewUri doesn't show picture but show background of imageview -


file file = new file("/storage/emulated/0/babycaredata/photo/20160229_161413.jpg"); if (file.exists()) {     views.setimageviewuri(r.id.imageavatar, uri.parse(file.getpath()));              }  

i have check path , uri,it right.setimageviewuridoesn't show picture show white screen(background white).

try this:

file file = new file(/storage/emulated/0/babycaredata/photo/20160229_161413.jpg);  if(file.exists()) {      bitmap mybitmap = bitmapfactory.decodefile(file.getabsolutepath());     setbitmap(views,r.id.imageavatar,mybitmap);  }      private void setbitmap(remoteviews views, int resid, bitmap bitmap){         bitmap proxy = bitmap.createbitmap(bitmap.getwidth(),bitmap.getheight(), bitmap.config.argb_8888);         canvas c = new canvas(proxy);         c.drawbitmap(bitmap, new matrix(), null);         views.setimageviewbitmap(resid, proxy);     } 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -