tags:

views:

902

answers:

1

Hi,

I start an IMAGE_CAPTURE Intent like this, and my activity's onActivityResult() get called:

Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null);
i.putExtra("return-data", true);
startActivityForResult(i, PICK_ICON_FROM_CAMERA_ID);

But, if I start my Intent like this, the Capture Image Intent did get called, but my activity's onActivityResult() never get called:

Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null);
i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse("file:/" + "MyTestFile"));
i.putExtra("outputFormat",    Bitmap.CompressFormat.PNG.name());
startActivityForResult(i, PICK_ICON_FROM_CAMERA_ID);

Can you please tell me how to get the 2nd case to work?

Thank you.

A: 

I think "file:/MyTestFile" is an incorrect uri. Try something like that:

File f=new File(Environment.getExternalStorageDirectory(),  "MyTestFile");
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(f));

The actual path would be "/sdcard/MyTestFile".

Fedor