Skip to content
Advertisement

TreeContentProvider just getting every Directory of my path. (File Filter)

im trying to get every folder of my path. Now Im getting just folders but as soon as some other file comes up it gives me a JavaNullPointerException. I know its beacuse of listFiles() but I dont know how to let it work otherwise. Can someone help me?

JavaScript

Advertisement

Answer

File.listFiles() returns null if the file is not a directory. This is causing your exception.

To just show directories use something like:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement