android - Resize a Image Picked from Gallery to Image View -


my app have activity imageview pick picture phone gallery , set in imageview user's profile picture.

my problem pictures when picked make app stop cause big, want know if can code , me how can resize picked picture, after set in image view, how can user cut picture before set, here below code pic picture. greatful if needed changes , give me code cause dont know developing. thank you.

 @override protected void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);      if (requestcode == result_load_image && resultcode == result_ok && null != data) {         uri selectedimage = data.getdata();         string[] filepathcolumn = { mediastore.images.media.data };          cursor cursor = getcontentresolver().query(selectedimage,                 filepathcolumn, null, null, null);         cursor.movetofirst();          int columnindex = cursor.getcolumnindex(filepathcolumn[0]);         string picturepath = cursor.getstring(columnindex);         preferencemanager.getdefaultsharedpreferences(this).edit().putstring("picturepath", picturepath).commit();         cursor.close();          imageview imageview = (imageview) findviewbyid(r.id.user);         imageview.setimagebitmap(bitmapfactory.decodefile(picturepath));      }      } 

try image compression whtsapp have used in application https://www.built.io/blog/2013/03/improving-image-compression-what-weve-learned-from-whatsapp/


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -