Android设备专用相机路径问题 [英] Android device specific camera path issue

查看:217
本文介绍了Android设备专用相机路径问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,我的问题是这个问题和<一href="http://stackoverflow.com/questions/6172902/camera-activity-problem-in-different-android-devices">this 之一。但我仍然有一些问题,所以不要尝试关闭或downvote我的问题啦。请继续通过充分的问题。

I know that my question is a duplicate of this question and this one. But still I have some problems, so don't try to close or downvote my question friends. Please go through the question fully.

在我的应用程序,我想图像存储到同一文件夹中的设备原生相机,并将它们存储。根据我的研究,我发现每个设备将图像存储到不同的名称,并在不同的文件夹。

In my app I want to store Images into the same folder as where the device native Camera stores them. As per my research, I have found out that each device stores the Images into a different name and in different folder.

这就是:

  • 的Nexus-One将其相机文件放到一个文件夹命名为摄像机(/ SD卡/ DCIM /摄像头)。

所有HTC设备存储自己的相机文件放到一个文件夹命名为 100MEDIA (/ SD卡/ DCIM / 100MEDIA)。

All HTC devices store their camera files into a folder named 100MEDIA (/sdcard/DCIM/100MEDIA).

索尼Xperia X10存储它的摄像头文件到一个文件夹命名为 100ANDRO (/ SD卡/ DCIM / 100ANDRO)。

Sony Xperia x10 stores its camera files into a folder named 100ANDRO (/sdcard/DCIM/100ANDRO).

摩托罗拉MilesStone存储它的摄像头文件到一个文件夹命名为摄像机(/ SD卡/ DCIM /摄像头)。

Motorola MilesStone stores its camera files into a folder named Camera (/sdcard/DCIM/Camera).

所以,我想知道这是否是编程可能得到这条道路,这样我可以存储我的应用程序带到同一位置的照片?

So I wanted to know if it's programmatically possible to get this path so that I can store the images taken from my app to the same location?

当我在Google上搜寻我发现,这是更好地创建自己的外部文件夹,这样我就可以存储图像在我指定名称的路径。之后,也是在API版本3(安卓1.5)HTC设备我发现,这是获得仅创建该文件夹,但图像获取保存在其默认位置有自己的名字。

When I was googling I found out that it's better to create an external folder of my own so that I can store the images in that path with the name I am specifying. After that also in HTC device of API version 3 (Android 1.5) I found out that only the folder is getting created but the image gets saved in its default place with a name of its own.

如何解决这个问题?是没可能找到会保存每个设备的图像的具体路径和名称?请帮我的朋友。

How to solve this issue? Is it not possible to find the specific path and name of the image that gets saved for each device? Please help me friends.

推荐答案

使用getExternalStorageDirectory(),如果API级别低于7,然后追加/图片获得的照片存储路径。

Use getExternalStorageDirectory() if API level is below 7 and then append /Pictures to get the path of Photos storage.

有关API级别> 7使用getExternalStoragePublicDirectory(DIRECTORY_PICTURES)。

for API level > 7 use getExternalStoragePublicDirectory (DIRECTORY_PICTURES).

这篇关于Android设备专用相机路径问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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