选择图片
拍照
1 2
| Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE startActivityForResult(intent,1);
|
相册选择
1 2 3 4 5 6 7 8
| Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent,2); ``` #### 获取图像URI 重写*onActivityResult*方法 #####camera ```java
|
#####photo
1
| Uri uri = data.getData();
|
图片栽剪
1 2 3 4 5 6 7 8 9 10 11 12
| Intent 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", 340); intent.putExtra("outputY", 340); intent.putExtra("return-data", true); startActivityForResult(intent, 500);
|