【发布时间】:2015-05-28 17:11:03
【问题描述】:
当我在应用程序中使用相机拍照时,应用程序/活动会在我保存拍摄的照片时重新启动(并且所有其他活动也会关闭)。另外,当我调试应用程序时,调试器会在拍照后断开连接。
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
File file = getOutputMediaFile(1);
picUri = Uri.fromFile(file);
i.putExtra(MediaStore.EXTRA_OUTPUT, picUri);
startActivityForResult(i, 0);
我的 onActivityResult:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case 0:
mProgress.show();
loadCameraImage();
break;
case 1:
mProgress.show();
Uri uri = imageReturnedIntent.getData();
loadFileImage(uri);
break;
}
}
}
【问题讨论】:
标签: android android-intent camera