I am trying to retrieve file listing from my (apache) http server via an android phone. Searched the web and forum without success. I was however able to do this in standard java using:
package at.klp.serverlist;
import java.net.URL;
import java.util.List;
import org.apache.ivy.util.url.ApacheURLLister;
public class ServerFileListJava {
public static void main(String[] args) {
URL url1;
List serverDir;
try {
url1 = new URL("http://...url to server...");
ApacheURLLister lister1 = new ApacheURLLister();
serverDir = lister1.listAll(url1);
System.out.println(serverDir);
}
catch (Exception e) {
e.printStackTrace();
}
}//end main
}//end class
Is a similar class available in Android, or can file listing somehow be done using org.apache.http*?
I do not really want to use a WebView, or separate the html code using HttpGet and HttpResponse.
Thanks a lot for helping, any ideas?
Solved thanks to your answers. I imported ivy-2.0.0-rc1.jar into my project, did not know that this works! This video demonstrates how to import .jar`s into an Android project: http://www.youtube.com/watch?v=eY_uqi_qIz0&noredirect=1
thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…