0

I have created a folder on sdcard for storing different type of files.

Now, i just need to show all file on click of application icon.

Can anyone provide me correct source code for this ?

Its urgent !!

Thanks in Advance !!

4

2 回答 2

0

你只是想要一个清单吗?

File directory = getMyDirectory(); // do this however you want
File[] files = directory.listFiles(); // gets an array of files in the dir.
于 2012-04-13T16:57:32.737 回答
0
public void directoryPath(File path) {
        // TODO Auto-generated method stub
        if( path.exists() ) {
            File[] files = path.listFiles();
            for(int i=0; i<files.length; i++) {
                //you can do what you want here
            }
        }
    }

上面的代码给出了文件夹中的所有文件......

于 2012-04-13T17:37:05.620 回答