android - How to see list of files stored in a directory -
i have built app makes folder in storage of device. here code i'm using:
file wdirectory = new file("/sdcard/w/"); wdirectory.mkdirs(); file outputfile = new file(wdirectory, filename); fileoutputstream fos = new fileoutputstream(outputfile);
now want know how show files in list view in directory.
paste folder path....
file folder = new file("your/path"); file[] listoffiles = folder.listfiles(); (int = 0; < listoffiles.length; i++) { if (listoffiles[i].isfile()) { system.out.println("file " + listoffiles[i].getname()); } else if (listoffiles[i].isdirectory()) { system.out.println("directory " + listoffiles[i].getname()); } }
Comments
Post a Comment