First of all these functions are through the intent to start the service of the system to achieve, so naturally there is a corresponding action. The relevant actiong are as follows:
Photo--mediastore.action_image_capture ("Android.media.action.IMAGE_CAPTURE")
Album--intent.action_get_content ("Android.intent.action.GET_CONTENT" to be set at the same time, Intent.settype ("image/*");)
Crop--"Com.android.camera.action.CROP" (need to set picture source Intent.setdataandtype (URI, "image/*"); )
The parameters in the table below are the following additional features when sending intent, adding some additional data constraints
| Additional options |
Data type |
Describe |
| Crop |
String |
Send clipping signal intent.putExtra("crop", "true"); |
| Aspectx |
Int |
intent.putExtra( "aspectX" Scale , 1); in the x direction |
| Aspecty |
Int |
intent.putExtra( "aspectY" proportions , 1); in the y direction |
| Outputx |
Int |
intent.putExtra( "outputX" width , 240); of the cropping area |
| Outputy |
Int |
The intent.putExtra( "outputX" height , 320); of the cropping area |
| Scale |
Boolean |
Whether to preserve intent.putExtra( "scale" , true); proportions |
| Return-data |
Boolean |
Whether to keep data back intent.putExtra( "return-data" , true); in bitmap |
| Data |
Parcelable |
The corresponding bitmap data intent.putExtra( "data" , imgaeUri); |
| Circlecrop |
Boolean |
Circular cropping area intent.putExtra( "circleCrop" , true); |
| Mediastore.extra_output ("OUTPUT") |
Uri |
Point the URI to the corresponding file:///... Intent.putextra (mediastore.extra_output, Imageuri); |
| OutputFormat |
String |
Output format Intent.putextra ("OutputFormat", Bitmap.CompressFormat.JPEG.toString ()); |
| Nofacedetection |
Boolean |
Whether to cancel the face recognition function Intent.putextra ("Nofacedetection", true); |
Again, because these operations require results to be returned, the Startactivityforresult is used to send the intent, and then the activity is received for processing.
Android photography, getting and cropping from albums