0
我有這個代碼在獲取文本文件中找到的文本,並將其放在一個TextView中。從網站閱讀文本,並把它放在一個字符串(安卓,Eclipse)
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httppost = new HttpGet("http://www.website.nl/text.txt");
HttpResponse response = httpclient.execute(httppost);
HttpEntity ht = response.getEntity();
BufferedHttpEntity buf = new BufferedHttpEntity(ht);
InputStream is = buf.getContent();
BufferedReader r = new BufferedReader(new InputStreamReader(is));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line + "\n");
}
我試過了。我如何使用「總計」作爲字符串?
if(total.toString() == "Text")
{
//TODO
}