Android 图像捕捉不起作用
这个问题我见过很多次了。在每一个案例中,我都尝试过有人回答的源代码。它从来没有起作用。我所需要的只是捕捉图像!我只是使用 ACTION_IMAGE_CAPTURE 开始一个意图。
我遇到的问题: - 返回的图像永远不会是完整尺寸,即使指定了 EXTRA_OUTPUT - 如果指定了 EXTRA_OUTPUT,相机应用程序不会拍照 - 结果意图为 null 或 getData() 方法返回 null - 如果我提前为图像指定一个 Uri,然后稍后从该 Uri 加载图像,则宽度/高度始终为 -1。
我在这里发现了一个 Android 错误:http://code.google.com/ p/android/issues/detail?id=1480 该链接基本上表明这是不可能的,我需要编写自己的活动。我不知道如何做到这一点,有人有例子吗?
我在 stackoverflow.com 上找到了许多与此相关的主题。但目前还没有人找到可行的解决方案。有没有人找到一种方法来实现这项工作?
I have seen this question many times. In every single case I have tried the source code that someone answers with. It has never worked. All I need is to capture an image! I simply start an intent using ACTION_IMAGE_CAPTURE.
Issues I'm running into:
- Image returned is NEVER full size, even when EXTRA_OUTPUT is specified
- Camera application does not take photos if EXTRA_OUTPUT is specified
- Resulting intent is null or the getData() method returns null
- If I specify a Uri for the image in advance and then load the image later from that Uri the width/height are always -1.
I found an Android bug here: http://code.google.com/p/android/issues/detail?id=1480
That link basically says it's impossible and that I need to write my own activity. I have no clue how to do that though, does anyone have an example?
I've found numerous threads on this at stackoverflow.com. But no one has had a working solution yet. Has anyone found a way to make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我尝试了第一个 示例谷歌给了我,它工作正常,extra_output等等。使用 Eclipse 和标准虚拟设备,它可以在 1.5 及更高版本上运行。如果您正在做一些更奇特的事情,您可能需要使用 NDK 进行较低级别的访问。
I tried the first example google gave me and it worked fine, extra_output and all. Using Eclipse and the standard virtual devices it ran on 1.5 and up for me. If you're doing something more fancy you may need to use NDK for lower level access.
某些设备根本无法实现此目的。这是一个已知问题。这些设备已经过时了,我不再遇到它们了。
Certain devices simply don't work for this. It's a known issue. Those devices have moved on in age and I don't run into them anymore.