简单的方式在Android中/ DCIM获得股票摄像机图像的位置/? [英] SImple way to get stock camera images location in Android /DCIM/?

查看:231
本文介绍了简单的方式在Android中/ DCIM获得股票摄像机图像的位置/?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序的想法,并做我需要是那里的股票相机存储它的图片的文件夹中。但由于大部分manufactureres名里的DCIM文件夹diferently,有没有办法找到相机的照片保存到特定的文件夹。此外,我不能列出并打开第一个结果,因为,例如我在那里有5个文件夹。谢谢!

I have an idea for an app, and to do it i need to be in the folder where the stock camera stores it's pictures. But since most manufactureres name the folder inside DCIM diferently, is there a way to find the specific folder that the camera saves pictures into. Also I can't list and open the first result because, for example i have 5 folders in there. Thanks!

推荐答案

所以,我结束了.exists做()

So i ended up doing it with .exists()

String abcd = "is it working ?";
          File pathimg = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
          File testimg = new File (pathimg, "100MEDIA/");
          if (testimg.exists()){abcd = testimg.toString();}
          else {
              File testimg2 = new File (pathimg, "100ANDRO/");
              if (testimg2.exists()){abcd = testimg2.toString();}
              else {
                  File testimg3 = new File (pathimg, "Camera/");
                  if (testimg3.exists()){abcd = testimg3.toString();}
                  else {
                      File testimg4 = new File (pathimg, "100LGDSC/");
                      if (testimg4.exists()){abcd = testimg4.toString();}
                      else {
                          abcd = "It's not working";
                      }
                  }                   
              }
          }

在我的G2与文件夹100LGDSC它的工作。

On my G2 with the folder "100LGDSC" it's working.

这篇关于简单的方式在Android中/ DCIM获得股票摄像机图像的位置/?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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