NullPointerException - Attempt to get length of null array (readDirectory())
All you need to do is go into your manifest file and under the backup line just paste it
android:requestLegacyExternalStorage="true"
Done :)
f.listFiles()
will return null if the path does not exist.
Please check your path.
Update
Android will also require a permission to read certain files. Maybe you need to add this to your manifest:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
More information:
http://developer.android.com/reference/android/Manifest.permission.html