gpt4 book ai didi

android - 如何知道 SD 卡上存储图像的位置,DCIM/Camera,DCIM/100MEDIA?

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:39:26 24 4
gpt4 key购买 nike

我的应用程序中有一个方法可以检索我的 DCIM/Camera 文件夹中最后保存的图像,并将其复制到 SD 卡上的另一个位置。我刚刚在另一部手机上测试过它,发现它默认保存到 DCIM/100MEDIA。我怎样才能得到这条路?

我最终编写了一些代码,循环遍历 DCIM 文件夹中的所有文件夹并检索 lastModified() 文件夹的路径。

最佳答案

看起来它取决于制造商。除了使用书中描述的方法之外,允许用户选择/覆盖您“发现”的默认值似乎也是一个重要的选择。

来自 Pro Android 3:第 579 页

Unfortunately, there is not a method call to tell you which directory might be used underneath the DCIM directory for Camera pictures. There are a couple of methods though to tell you where the top of the SD card is. The first is Environment.getExternalStorageDirectory() and it returns a File object for the top-level directory for the SD card.

有关整页文本,请参阅以下 Google 图书链接: http://books.google.com/books?id=RuN0jb4YASwC&pg=PA579&lpg=PA579

  • 其他引用资料:

Do all Android phones with a built-in camera use a folder called "DCIM" to store captured images?

http://androidforums.com/android-lounge/5930-definitive-androids-folder-structure.html#post239353

关于android - 如何知道 SD 卡上存储图像的位置,DCIM/Camera,DCIM/100MEDIA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8621514/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com