只获取相机捕获的图像

时间:2014-04-11 05:54:16

标签: android android-camera android-camera-intent

我想编写一个模块来获取仅摄像头捕获图像的路径。我发现目录dcim方法返回dcim目录路径但我想知道哪个是相机捕获的图像路径或是否有任何相机意图得到这个。请帮忙...我的代码看起来像这样:

public static File readPathImages()
    {
        File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
        if (path.exists()) 
        {
            File test1 = new File(path, "Camera/");
            if (test1.exists())
                path = test1;
            else {
                File test2 = new File(path, "100ANDRO/");
                if (test2.exists())
                    path = test2;
                else {
                    File test3 = new File(path, "100MEDIA/");
                    if (test3.exists()) {
                        path = test3;
                    }
                }
            }
        }
        return path;
    }

0 个答案:

没有答案