Directly on the code:
1 //start cropping a picture2 Private voidCropphotouri (Uri uri) {3Intent Intent =NewIntent ("Com.android.camera.action.CROP");4Intent.setdataandtype (URI, "image/*");//Set Crop type5 //Set Crop6Intent.putextra ("Crop", "true");7 //Set width height ratio8Intent.putextra ("Aspectx", 1);9Intent.putextra ("Aspecty", 1);Ten //set the length width of a picture OneIntent.putextra ("Outputx", 150); AIntent.putextra ("Outputy", 150); -Intent.putextra ("Return-data",true); - Startactivityforresult (Intent, crop_photo); the}
Again we need to rewrite the Onactivityresult () method to get the return result
1 @Override2 protected voidOnactivityresult (intRequestcode,intResultCode, Intent data) {3 Super. Onactivityresult (Requestcode, ResultCode, data);4 if(data!=NULL) {5 6Bundle bundle =Data.getextras ();7Photo = Bundle.getparcelable ("Data"); 8 }9}
Here bundle.getparcelable ("data") inside the key value "data" is the system is defined, we do not need to modify
android--start the cut image function of the system and return the results