In my app I call the system camera to take a picture, and then handle the result in onActivityResult. It used to work, but now my calling activity gets killed sometimes,
sometimes it works well.I need the big picture,so I must use intent.putExtra(MediaStore.EXTRA_OUTPUT, output)
,if without this(like use the intent data to get a bitmap) ,it works fine.
after take a pic, and onclick the 'OK' button, I need it return to the activity
which start the camera,but sometime it works fine,sometimes the parent activity is finished. after search,I set android:alwaysRetainTaskState="true"
,but this not work.
my system is Galaxy S I9000,I also test this on other phone,but it works well.
did anybody know why?
here is my code
private void startTakePhoto(){
App.fileNameWithPath = Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator + System.currentTimeMillis()+".jpg";
File file = new File(App.fileNameWithPath);
Uri output = Uri.fromFile(file);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, output);
boolean flag = BaseUtil.hasImageCaptureBug();
System.out.println(flag);
//intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(fileNameWithPath)));
//BaseUtil.saveImagePath(App.fileNameWithPath, this);
startActivityForResult(intent, REQUEST_TAKE_PHOTO);
}
It like this : I want is 1. A start B (stack: A,B) 2. B start camera activity and wait For Result (stack:A,B,camera) 3. save picture,return B activity (stack: A,B) but on step 3, it not return to B,but A. It seems like B is finished by the system, why?