我想从服务器端获取数据,然后再使用asynctask从服务器端获取数据,但是由于我有了aquery的想法,现在我想使用aquery库来获取数据bu。我的服务器页面仅返回一个字符串,但是通过使用查询我没有得到响应,结果显示为空。请让我知道有关aquery的功能,并提供一个链接以获取有关aquery的更多信息。
这是我用来从服务器获取数据的...
aqu=new AQuery(getApplicationContext());
aqu.ajax("here goes my url", String.class, new AjaxCallback<String>() {
@Override
public void callback(String url, String html, AjaxStatus status) {
Log.d("here you go",html+"////////////////////"+url);
}
});
在html变量中,我得到的是空值,因为这应该是正确的响应,但我无法获得响应。
这将为您提供帮助。通过调用webservice的Aquery .. http://programmerguru.com/android-tutorial/android-json-parsing-tutorial-using-aquery/
更新:对本教程中的功能进行以下更改:
public void updateCitySpinnerCtrl(String country) {
//JSON URL
String url = "http://apps.programmerguru.com/json/getcity.php?country="+ country;
//Make Asynchronous call using AJAX method
aq.progress(R.id.progressBar1).ajax(url, **String.class,** this,"jsonCallback");
}
public void jsonCallback(String url, **String** **res**, AjaxStatus status) {
//When JSON is not null
Log.i("json="+res,"response");
if (json != null) {
//write you code here
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句