Just a quick question, how to I get a list of directories inside a specified directory.
for example,
String path = Environment.getExternalStorageDirectory().toString()+"/myApp/";
now I'd need to get the list of directories that are inside the "path" directory.
Thanks!
File myDirectory = new File("path to some directory"); File[] directories = myDirectory. listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname. isDirectory(); } });
android.provider.ContactsContract.Directory. A Directory represents a contacts corpus, e.g. Local contacts, Google Apps Global Address List or Corporate Global Address List. A Directory is implemented as a content provider with its unique authority and the same API as the main Contacts Provider.
Something like that (add null checking, exceptions etc..)
File f = new File(path); File[] files = f.listFiles(); for (File inFile : files) { if (inFile.isDirectory()) { // is directory } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With