0

I have an app that a user will be able to take pictures with. Having the camera is a small, but necessary feature but I want it to only be able to take pictures (no video). Is there a way I can make it startIntentForResult with a pictures-only camera intent? Or perhaps make it only accept images as the result? Making my own custom camera for the app seems a bit overkill, but I will do it if I have to.

Thanks

snotyak
  • 3,709
  • 6
  • 35
  • 52

1 Answers1

2

This code has been working for me for ever

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
Uri uri = Uri.fromFile(File.createTempFile("image", ".jpg"));
cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(Intent.createChooser(cameraIntent, "Take Picture", 0);
Sherif elKhatib
  • 45,786
  • 16
  • 89
  • 106
  • Wow...cool. It doesn't work correctly (when actually hitting the "check") but I think it's because I'm running a nightly ROM. I'll try on my other phone in a bit. Thanks! – snotyak Sep 10 '12 at 08:13