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.setimageviewuri
doesn'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
Post a Comment