开发者

Retrieving content of a txt file from URL to Android

开发者 https://www.devze.com 2023-02-04 11:48 出处:网络
I would like to be able to retrieve contents of a .txt file from the internet, and load it in an EditText. I tried using the code on this page: Reading Text File From Server on Android

I would like to be able to retrieve contents of a .txt file from the internet, and load it in an EditText. I tried using the code on this page: Reading Text File From Server on Android

It didn't work, as you might have guessed. I've read on numerous sites about this type of problem, but I can't get anything to work. Someone suggested AndroidHttpClient but I simply can't find any examples w开发者_如何学编程ith this.

As I'm a newbie in Android programming, I would love if someone could please give me a small example.


This isn't so much of an Android question as it is a Java question. There are a few ways you could go about doing this, but the simplest might be using java.net.HttpURLConnection.

0

精彩评论

暂无评论...
验证码 换一张
取 消