我想autoCompleteTextview
根据网络服务的建议创建一个。在文本更改时,我使用输入的文本调用 Web 服务。
public String searchpalace_Searchtext(String serchtext)
{
String resultString = "";
try {
String searchtext = URLEncoder.encode(String.valueOf(serchtext), "UTF-8");
HttpClient Clientloc = new DefaultHttpClient();
String URL = baseUrl + "places?name=" + searchtext;
HttpGet httpget = new HttpGet(URL);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
resultString = Clientloc.execute(httpget, responseHandler);
}
catch (Exception e) {
resultString = "";
}
return resultString;
}
此函数在asyncTask
输入或删除到达字符时调用。现在,当快速输入文本时,我想在新请求到达时取消挂起的请求。如何取消之前的请求?