我对android开发很新,所以请原谅我的无知.我需要能够以15分钟的间隔从远程网页上读取一些文本.网页本身只包含一个没有html标签或格式的单词.如果有人可以指出我正确的方向,我会很感激.
谢谢
当然,请尝试以下方法
try {
// Create a URL for the desired page
URL url = new URL("yoursite.com/thefile.txt");
// Read all the text returned by the server
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str = in.readLine();
in.close();
} catch (MalformedURLException e) {
} catch (IOException e) {
}
Run Code Online (Sandbox Code Playgroud)