I was have written to run simple android camera application to run it on android 4.
The code initially had camera intent defined as
Intent cameraIntent = new Intent();
cameraIntent.setType(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
When I tried to run this application it was throwing below exception :-
07-07 12:44:09.755: E/AndroidRuntime(11533): android.content.ActivityNotFoundException: No Activity found to handle Intent { typ=android.media.action.IMAGE_CAPTURE }
However when I tried to run same program by defining “cameraIntent” as below it worked fine –
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
I thought passing “action” to intent through setter or through constructor would be same.
But it doesn’t seems so, as passing “action” through setter method throws exception while passing it through constructor to new Intent works fine. Any idea why so?
this code work fine:
instead of
becuase
setType(String type) used for:
and
setAction(String action) used for: