如何获取存储在SD卡中的图像数量

Kal*_*n.G 2 android android-emulator android-intent android-layout

我需要计算存储在SD卡中的图像数量,因此我想将图像命名为Sample0,Sample1,Sample2,Sample3等.可能吗?

Che*_*het 9

它给出了SD卡图像文件夹中的图像数量:

File dir = new File(Environment.getExternalStorageDirectory()
                + "/images");
        File[] files = dir.listFiles();
        int numberOfImages=files.length;
Run Code Online (Sandbox Code Playgroud)