Getting the Android camera folder before API 8
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.
精彩评论