Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MEDIA_TYPE_IMAGE not recognized

I'm having trouble with the resource on android developers for the camera, here is my code:

// create Intent to take a picture and return control to the calling application
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);

// create a file to save the image
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
// start the image capture Intent
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);

The problem is 'MEDIA_TYPE_IMAGE' which says that it can not be resolved to a variable. I got mediastore, camera and URI imported into my project. Thanks in advance!

like image 407
user1337210 Avatar asked May 15 '12 08:05

user1337210


1 Answers

Try importing android.provider.MediaStore.Files.FileColumns and change MEDIA_TYPE_IMAGE to FileColumns.MEDIA_TYPE_IMAGE.

If you are using the sample code from Android developers blog be sure to check the section about saving media files, there you have the constants created to handle that.

like image 81
Alejandro Moya Avatar answered Sep 25 '22 03:09

Alejandro Moya