相机action:MediaStore.ACTION_IMAGE_CAPTURE
向外存:
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(newFile("")));
接收:
if(requestCode ==requestCode &&resultCode == RESULT_OK){
Bitmap bm =data.getParcelableExtra("data");
}
相册 action:Intent.ACTION_PICK
调用相册需要Intent.setType("image/*");
接收:
if(requestCode ==requestCode &&resultCode == RESULT_OK){
Uri uri =data.getData();
}
Intent.ACTION_GET_CONTENT
这个不需要setType,可以直接选择一个文件返回
裁剪:
Intent intent = newIntent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
//执行裁剪的指令
intent.putExtra("crop", "true");
//裁剪框的宽高比
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
//输出时候的宽度和高度
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 200);
//设置取消人脸识别
intent.putExtra("noFaceDetetion", false);
//设置返回数据
intent.putExtra("return-data", true);
startActivityForResult(intent,1000);