How can we get the list of directories from a URL. e.g. from abc.com/myfolders? in Android.
If there are following folders in a URL
- abc.com/myfolders/folder1
- abc.com/myfolders/folder2
- abc.com/myfolders/folder3
- abc.com/myfolders/folder4
then how can the list be populated with
folder1
folder2
folder3
folder4
I know it has been too late but i am posting this answer for other user's who is looking for same.
You can write PHP web service to get a list of file's located in particular folder of server.
and then call this service in your java or android code.
You can't get a list of folders from a URL, unless the URL is configured to respond with the extra path elements that are valid. URLs are not necessarily a reflection of a server's file system, and therefore folder structure.
It sounds like you want something similar to the standard way some web servers allow for file browsing. I.e., when you navigate to
http://server/a/path/
the web server responds with a HTML page that lists the contents of that folder on the server.
Without that, you cannot find out the 'folders' within a URL.
If I've missed the point, then any of the other answers describing String concatenation should work.
Try with the following code
This should do it.