调用相册:
Intent i = new Intent(Intent.ACTION_PICK, null);
Intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(i,code);
onActivityResult(int a,int b,Intent data){
String imageUri = data,getData();
}
调用相机拍摄:
intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
//下面这句指定调用相机拍照后的照片存储的路径
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "test2.jpg")));
startActivityForResult(intent, 2);