If you call the system image interface:
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);//intent.addCategory(Intent.CATEGORY_OPENABLE);//intent.setType("image/*"); startActivityForResult(intent, REQUEST_CODE_SELECT_PHOTO);
@ Override protected void onactivityresult (INT requestcode, int resultcode, intent data) {If (requestcode = request_code_select_photo) {try {// onphotoselected (data); Final URI originaluri = data. getdata (); If (originaluri = NULL) {return;} startphotozoom (originaluri);} catch (exception e) {If (logsettings. market) {mktlog. E (TAG, "onphotoselected ():" + E. getmessage () ;}} return ;}} public void startphotozoom (URI) {// This is the intent = new intent ("com. android. camera. action. crop "); intent. setdataandtype (Uri, "image/*"); intent. putextra ("crop", "true"); intent. putextra ("aspectx", 1); intent. putextra ("aspecty", 1); intent. putextra ("outputx", 150); intent. putextra ("outputy", 150); intent. putextra ("Return-Data", true); startactivityforresult (intent, request_code_select_cut_photo );}
After cropping, you can use the following in onactivityresult:
if(requestCode == REQUEST_CODE_SELECT_CUT_PHOTO) { try { Bitmap bm = data.getParcelableExtra("data"); } catch (Exception e) { if (LogSettings.MARKET) { MktLog.e(TAG, "onPhotoSelected() : " + e.getMessage()); } }
Image cropping interface:
Use the default system interface to cut Images