View Single Post
  #10 (permalink)  
Old 12-12-2007, 11:51 PM
staykovmarin staykovmarin is offline
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
Hmm the problem right now is that you are scanning files as well, so the FileFilter is not working. I have no idea why its not, unless maybe you dont have your eclipse actually using java 5+ for a compiler: Window > Prefferences > Java > Compiler, select 5 or 6 from the drop down.

Here is a revised code that doesnt use a FileFilter: (note: i am not compiling this, because i dont have java atm, but it should work)
Code:
private ArrayList<File> getFolders(File folder) { ArrayList<File> listAr = new ArrayList<File>(); File[] list = folder.listFiles(); // puts all the items from the array in an arraylist for (int i = 0; i < list.length; i++) { if (listAr.add(list[i]).isDirectory()) listAr.add(list[i]); } return listAr; }
Reply With Quote