启动系统内置拍照功能:
Intent localIntent=new Intent("android.media.action.IMAGE_CAPTURE");
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
if(fileUri == null)
System.out.println("fileUri is null, first");
localIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
startActivityForResult(localIntent, 1);
附带拍照后图片保存地址这个参数fileUri
回调函数处理图片:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode){
case 1:
if(data==null){
mCurrentPhotoPath = getRealPathFromURI(fileUri);
setPic(imageNum);
}else{
fileUri=data.getData();
mCurrentPhotoPath = getRealPathFromURI(fi