开发者

Getting the Android camera folder before API 8

开发者 https://www.devze.com 2023-03-27 21:25 出处:网络
In Android 2.2 and newer, you can get the default camera folder using Environment.DIRECTORY_DCIM, but is there a way t开发者_如何学Co get it in Android 2.1 and earlier?No, sorry. You can try:

In Android 2.2 and newer, you can get the default camera folder using Environment.DIRECTORY_DCIM, but is there a way t开发者_如何学Co get it in Android 2.1 and earlier?


No, sorry. You can try:

new File(Environment.getExternalStorageDirectory(), "DCIM")

and see how stable that is.

Bear in mind that neither my technique nor Environment.DIRECTORY_DCIM will necessarily be honored by all devices. When the Android documentation refers to Environment.DIRECTORY_DCIM as the "traditional location for pictures and videos when mounting the device as a camera" (emphasis mine), a warning bell should be going off in your mind. Just because it is "traditional" does not mean any device manufacturer will necessarily use it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号