我有一个代码用于拍摄照片并在之前在地图上显示。即使我没有改变与该部分相关的代码,它在安装android 2.3.6后也无法正常工作。我调试了代码,代码没有进入onActivityResult方法。我现在无法在其他版本中调试该软件。任何人都可以帮我解决这个问题。相关代码如下:
protected void startCameraActivity() {
File fileDirectory = new File(Environment.getExternalStorageDirectory()+ filePath);
// have the object build the directory structure, if needed.
fileDirectory.mkdirs();
imageNumber++;
File file = new File(fileDirectory, "image_" + imageNumber
+ ".jpg");
if (file.exists()) file.delete();
Uri outputFileUri = Uri.fromFile(file);
imagePath = file.toString();
Intent intent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (resultCode) {
case -1:
// this code performs operations about the saved image file
new LongOperation().execute("");
break;
}
switch (requestCode) {
case 3:
enableGPS();
break;
}
}
答案 0 :(得分:2)
在onActivityResult()
super.onActivityResult(requestCode, resultCode, data);
答案 1 :(得分:0)