Code example for File

Methods: isDirectory, isFile, isHidden

0
		// Checks whether path exists 
		if (path.exists()) { 
			FilenameFilter filter = new FilenameFilter() { 
				@Override 
				public boolean accept(File dir, String filename) {
					File sel = new File(dir, filename);
					// Filters based on whether the file is hidden or not 
					return (sel.isFile() || sel.isDirectory())
							&& !sel.isHidden();
 
				} 
			}; 
 
			String[] fList = path.list(filter);
			fileList = new Item[fList.length];
			for (int i = 0; i < fList.length; i++) {
				fileList[i] = new Item(fList[i], R.drawable.file_icon);
 
				// Convert into file path 
				File sel = new File(path, fList[i]);