MEDIA_TYPE_IMAGE无法识别 [英] MEDIA_TYPE_IMAGE not recognized
问题描述
我在使用android上开发的摄像头资源的麻烦,这是我的code:
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);
问题是'MEDIA_TYPE_IMAGE',这表示,它不能被解析到一个变量。我mediastore,摄像头和URI导入到我的项目。在此先感谢!
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!
推荐答案
尝试导入的 android.provider.MediaStore.Files.FileColumns
和变化 MEDIA_TYPE_IMAGE
到 FileColumns.MEDIA_TYPE_IMAGE
。
如果您使用的是来自Android开发者博客样品code,一定要检查的部分有关的储蓄媒体文件,有你有常量创建来处理的。
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.
这篇关于MEDIA_TYPE_IMAGE无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!