Friday, 15 February 2013

how to crop image and save them in app's cache memory or hidden folder in Android -



how to crop image and save them in app's cache memory or hidden folder in Android -

so far manage select image gallery , save it's link in sqlite. , i'm able retrieve imageview. want crop image , save cropped image cache folder. want because app crashing due lack of image size.

this code:

((button) gv.findviewbyid(r.id.etpetimg)) .setonclicklistener(new onclicklistener() { public void onclick(view arg0) { intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); //intent.putextra("crop", "true"); //intent.putextra("aspectx", 0); //intent.putextra("aspecty", 0); //intent.putextra("outputx", 200); //intent.putextra("outputy", 200); //intent.putextra("return-data", true); startactivityforresult(intent.createchooser(intent,"select picture"), select_picture); } }); public void onactivityresult(int requestcode, int resultcode, intent data) { if (resultcode == activity.result_ok) { if (requestcode == select_picture) { uri selectedimageuri = data.getdata(); selectedimagepath = getpath(selectedimageuri); //to image path system.out.println("image path : " + selectedimagepath); img.setimageuri(selectedimageuri); //imgbtn.seti } } } public string getpath(uri uri) { string[] projection = { mediastore.images.media.data }; //cursor cursor = managedquery(uri, projection, null, null, null); cursor cursor = getactivity().getcontentresolver().query(uri, projection, null, null, null); int column_index = cursor.getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); homecoming cursor.getstring(column_index); }

as can see got reply cropping image need reply saving image cache , save cache links sqlite. , great if can reply how maintain image size lower(150kb) when saving cache. please reply android java code?

as have mentioned - cropping code done.

where store cropped image - database may not right choice

save cropped images in private application folder or external application cache directory , store link in sqlite db store total image.

see adding folder in internal storage in public? more details on options can store files

android image sqlite caching android-fragments

No comments:

Post a Comment