My app worked fine but after a reinstall I got the error that "attempt to get length of null array", while my dob folder is full of files that starting with pi_. Now I get files - Null.
Can anybody help what the error can be?
Thanks
File path = new File(Environment.getExternalStorageDirectory().toString() + "/dob");
    if (path.exists()) {
        Toast.makeText(this, "Dob folder exists", Toast.LENGTH_SHORT).show();
    } else {
        Toast.makeText(this, "Dob folder does not exist", Toast.LENGTH_SHORT).show();
    }
    File[] files = path.listFiles();
    if (files != null) {
        Toast.makeText(this, "files length: " + files.length, Toast.LENGTH_SHORT).show();
        piStarters = new String[files.length];
        int db = 0;
        for (File file : files) {
            Toast.makeText(this, ":" + file.toString() + ":", Toast.LENGTH_LONG).show();
            if (file.getName().startsWith("pi_")) {
                piStarters[db] = file.getName();
                Toast.makeText(this, "I need this (pistarter): " + piStarters[db], Toast
                        .LENGTH_SHORT)
                        .show();
                db++;
            }
        }
    } else {
        Toast.makeText(this, "files - Null ", Toast
                .LENGTH_SHORT).show();
    }
Manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
 
    