Skip to content Skip to sidebar Skip to footer

Android: Isdirectory() Always Returning True

I tried here, but it did not help. My filename filter to get directories and .txt files only: FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, Str

Solution 1:

The File dir passed is the directory containing the actual file, so it will always be a directory. The full file you have is %dir%/%name%. I believe name will be "/" or perhaps null if the overall file is a directory though.

You could also create the full file by doing new File(dir, name);

Post a Comment for "Android: Isdirectory() Always Returning True"