GroupExpenseManager/src/com/AndroidFriends/src/GroupsActivity.java
// Load list of files at given path into fileList
Load list of files at given path into fileList
Load list of files at given path into fileList
private void loadFileList(File mPath) {
		String[] tempFileList;
	    if(mPath.exists()) {
	        FilenameFilter filter = new FilenameFilter() {
	            public boolean accept(File dir, String filename) {
	                File sel = new File(dir, filename);
	                return (filename.endsWith(GroupSummaryActivity.DB_EXTENSION) || sel.isDirectory()) && !sel.isHidden();
	            }
	        };
	        tempFileList = mPath.list(filter);
	        Arrays.sort(tempFileList);
	        if (dirLevel == 0) {
		    	 fileList = tempFileList;
		    }
	        else {
	        	fileList = new String[tempFileList.length+1];
	        	fileList[0] = "..";
	        	for (int i=0; i<tempFileList.length; i++) {
	        		fileList[i+1] = tempFileList[i];
	        	}
	        }
	        fileItemList = new fileItem[fileList.length];
	        for (int i=0; i<fileList.length; i++) {
	        	if (fileList[i] == "..") {
	        		fileItemList[i] = new fileItem(fileList[i], R.drawable.file_up_directory);
	        	}
	        	else {
	        		File tempFile = new File(mPath, fileList[i]);
	        		if (tempFile.isDirectory()) {
	        			fileItemList[i] = new fileItem(fileList[i], R.drawable.file_directory);
	        		}
	        		else {
	        			fileItemList[i] = new fileItem(fileList[i], R.drawable.file_db);
	        		}
        		}
	        }
	    }
	    else {
	        fileItemList= new fileItem[0];
	        fileItemList[0] = new fileItem();
	    }
	}
private void loadFileList ( File mPath ) { String [ ] tempFileList ; if ( mPath . exists ( ) ) { FilenameFilter filter = new FilenameFilter ( ) { public boolean accept ( File dir , String filename ) { File sel = new File ( dir , filename ) ; return ( filename . endsWith ( GroupSummaryActivity . DB_EXTENSION ) || sel . isDirectory ( ) ) && ! sel . isHidden ( ) ; } } ; tempFileList = mPath . list ( filter ) ; Arrays . sort ( tempFileList ) ; if ( dirLevel == 0 ) { fileList = tempFileList ; } else { fileList = new String [ tempFileList . length + 1 ] ; fileList [ 0 ] = ".." ; for ( int i = 0 ; i < tempFileList . length ; i ++ ) { fileList [ i + 1 ] = tempFileList [ i ] ; } } fileItemList = new fileItem [ fileList . length ] ; for ( int i = 0 ; i < fileList . length ; i ++ ) { if ( fileList [ i ] == ".." ) { fileItemList [ i ] = new fileItem ( fileList [ i ] , R . drawable . file_up_directory ) ; } else { File tempFile = new File ( mPath , fileList [ i ] ) ; if ( tempFile . isDirectory ( ) ) { fileItemList [ i ] = new fileItem ( fileList [ i ] , R . drawable . file_directory ) ; } else { fileItemList [ i ] = new fileItem ( fileList [ i ] , R . drawable . file_db ) ; } } } } else { fileItemList = new fileItem [ 0 ] ; fileItemList [ 0 ] = new fileItem ( ) ; } }
Load list of files at given path into fileList
Load list of files at given path into fileList
// Add icons to the files in the current directory