刚开始使用AndroidQuery处理 JSON 异步任务,我不熟悉 JSON 响应代码。在使用 AQ 方法之前,我没有收到任何错误,但现在我收到 103 TRANSFORM_ERROR。
下面是 JSON 字符串和我的代码片段。对我可能有什么问题有任何想法吗?谢谢
通过 php 返回的 JSON:
{"items":[{"_id":"1","label":"AC","title":"Advisory Circulators","description":"Provides guidance such as methods, procedures, and practices for complying with regulations and requirements.","date":"2008-03-03","gotoURL":null},{"_id":"2","label":"AD","title":"Airworthiness Directives","description":"Legally enforceable rules that apply to aircraft, aircraft engines, propellers, and appliances.","date":"2012-06-08","gotoURL":"javascript:navClickListener('bodyContent', dns + '\/wiki\/index.php\/Airworthiness_Directive #content');"},{"_id":"3","label":"CFR","title":"Code of Federal Regulations","description":"Official Rulemaking documents of the CFR in Title 14 and have been published in the Federal Register","date":"2012-01-31","gotoURL":"javascript:navClickListener('bodyContent', dns + '\/wiki\/index.php\/Main_Page #content');"},{"_id":"4","label":"PMA","title":"Parts Manufacturer Approvals","description":"Parts Manufacturer Approvals","date":"2012-01-31","gotoURL":null},{"_id":"5","label":"SAIB","title":"Special Airworthiness Info Bulletins","description":"Bulletins issued by manufacturers to provide modification or inspection instructions.","date":"2012-01-31","gotoURL":null},{"_id":"6","label":"SFAR","title":"Special Federal Aviation Regulation","description":"Official Rulemaking documents that have changed the language of the CFR in Title 14 CFR for aviation.","date":"2012-01-31","gotoURL":null},{"_id":"7","label":"STC","title":"Supplemental Type Certificates","description":"Document issued by the Federal Aviation Administration approving a product (aircraft, engine, or propeller) modification","date":"2012-01-31","gotoURL":null},{"_id":"8","label":"TSO","title":"Technical Standard Orders","description":"Minimum performance standards issued by the FAA for specified materials, parts, processes, and appliances used on civil aircraft.","date":"2012-01-31","gotoURL":null},{"_id":"9","label":"TCDS","title":"Type Certificate Data Sheets","description":"Repository of Make and Model information of aircraft, engine or propeller including airspeed, weight, and thrust limitations, etc.","date":"2012-01-31","gotoURL":null}]}
主要活动:
public class MainActivity extends Activity implements AnimationLayout.Listener
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
...
async_array();
}
AQuery aq;
static JSONArray jArray;
String json = null;
public void async_array()
{
aq = new AQuery(this);
String url = "http://192.168.1.11/Andaero/php/regulatory_list.php";
aq.ajax(url, JSONArray.class, new AjaxCallback<JSONArray>()
{
@Override
public void callback(String url, JSONArray json, AjaxStatus status)
{
if (json != null)
{
// successful ajax call, show status code, json content
// jsonListCallback(json);
Toast.makeText(aq.getContext(), status.getCode() + ":" + json.toString(), Toast.LENGTH_LONG).show();
}
switch (status.getCode())
{
case AjaxStatus.TRANSFORM_ERROR:
Toast.makeText(aq.getContext(), "TRANSFORM_ERROR: " + status.getCode(), Toast.LENGTH_LONG).show();
break;
case AjaxStatus.NETWORK_ERROR:
Toast.makeText(aq.getContext(), "NETWORK_ERROR " + status.getCode(), Toast.LENGTH_LONG).show();
break;
case AjaxStatus.AUTH_ERROR:
Toast.makeText(aq.getContext(), "AUTH_ERROR" + status.getCode(), Toast.LENGTH_LONG).show();
break;
case AjaxStatus.NETWORK:
Toast.makeText(aq.getContext(), "NETWORK" + status.getCode(), Toast.LENGTH_LONG).show();
break;
default:
Toast.makeText(aq.getContext(), "OTHER ERROR" + status.getCode(), Toast.LENGTH_LONG).show();
break;
}
}
});
}