MEDIA_TYPE_IMAGE无法识别 [英] MEDIA_TYPE_IMAGE not recognized

查看:141
本文介绍了MEDIA_TYPE_IMAGE无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Android开发人员的相机资源时遇到问题,这里是我的代码:

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,camera和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开发人员博客的示例代码,请检查有关保存媒体文件的部分,您已创建要处理的常量

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆