我以前有一个用于拍照并在地图上显示它们的代码。即使我没有更改与该部分相关的代码,安装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;
}
}