android - Set image into imageview from camera folder -
i have imageview in gallery selected images need set when select camera folder images, selected image not set in imageview .
if (requestcode == request_pick_image_from_gallery ) { uri selectedimg = data.getdata(); string[] filepath = {mediastore.images.media.data}; cursor c = getactivity().getcontentresolver().query(selectedimg, filepath, null, null, null); c.movetofirst(); int columnindex = c.getcolumnindex(filepath[0]); string picturepath = c.getstring(columnindex); bitmap = bitmapfactory.decodefile(picturepath,options); muserprofileimage.setimagebitmap(bitmap); }
if(selectedimg!=null) { c = getactivity().getcontentresolver().query(selectedimg, filepath, null, null, null); }else{ toast.maketext(mcontext,"this image not exiest in device",toast.length_short).show(); return; } f = new file(picturepath); muserprofileimage.setimagebitmap(bitmapfactory.decodefile(path,options)); // call after copied image , , delete after
if (f != null) { f.delete(); // set f in imageview , handled npe, no crash appeared. } i got solution of problem, when capture images camera , got stored in temp.png, , copy image other path , delete temp.png, when again try set deleted image , not set , handled nep also.
i debugged , corrected code . :)
Comments
Post a Comment