编程技术网

关注微信公众号,定时推送前沿、专业、深度的编程技术资料。

 找回密码
 立即注册

QQ登录

只需一步,快速开始

极客时间

MEDIA_TYPE_IMAGE 无法识别:MEDIA_TYPE_IMAGE not recognized

Can Poyrazoğlu 图像识别 2022-5-7 09:49 7人围观

腾讯云服务器
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",它表示无法解析为变量.我将媒体商店、相机和 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 无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程技术网(www.editcode.net)!

腾讯云服务器 阿里云服务器
关注微信
^