MEDIA_TYPE_IMAGE 无法识别 [英] MEDIA_TYPE_IMAGE not recognized

查看:17
本文介绍了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 无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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