在Android Q上刷新图库

时间:2019-09-13 14:38:50

标签: java android android-mediascanner android-10.0

使用while(true){ newExpr = constructNextExpression( add, sub, mul, div, Lparan, Rparan, sqr, sqrt, a, b, c, d, e, result ) found = true for (values in valueArray){ if(eval(newExpr(values) == false)) { found = false break } } if(found) return newExpr } 将视频保存到内部存储后,如果我从菜单(显示内部存储)进入 Files Explorer应用>视频>,就可以找到它

enter image description here

但是我在画廊中找不到它。

创建路径:

getExternalFilesDir

刷新图库

private void getPath() {
        String videoFileName = "vidoe_" + System.currentTimeMillis() + ".mp4";
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            File imageFile = null;
            File storageDir = new File(getExternalFilesDir(Environment.DIRECTORY_MOVIES),
                    "folder");
            boolean success = true;
            if (!storageDir.exists()) {
                success = storageDir.mkdirs();
            }
            if (success) {
                imageFile = new File(storageDir, videoFileName);
                savedVideoPath = imageFile.getAbsolutePath();
            }

        } else {
            File storageDir = new File(
                    Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES)
                            + "/folder");
            boolean success = true;
            if (!storageDir.exists()) {
                success = storageDir.mkdirs();
            }
            if (success) {
                File videoFile = new File(storageDir, videoFileName);
                savedVideoPath = videoFile.getAbsolutePath();
            }
        }
    }

0 个答案:

没有答案