2009-06-26 5 views
2

ich eine IMAGE_CAPTURE Intent wie folgt beginnen, und onActivityResult() meine Tätigkeit des gecallt:IMAGE_CAPTURE Intent kehrt nie zu onActivityResult zurück (int, int, Intent);

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

Aber, wenn ich meine Absicht wie folgt beginnen, hat die Bildaufnahme Intent gecallt, aber meiner Tätigkeit onActivityResult() nie aufgerufen:

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); 

können Sie mir bitte sagen, wie der 2 nd Fall an der Arbeit?

Antwort

2

Ich denke, "Datei:/MyTestFile" ist eine falsche URI. Versuchen Sie etwas wie das:

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

Der tatsächliche Pfad wäre "/ sdcard/MyTestFile".