我有一个 json 对象,它被作为字符串收集到一个函数中。
它包含数组
{"officer_name":"VM ARORA"}{"officer_name":"CP REDDY 博士"}{"officer_name":"ARTI CHOWDHARY"}{"officer_name":"JAGDISH SINGH"}
这是android代码
public void func4(View view)throws Exception
{
AsyncHttpClient client = new AsyncHttpClient();
RequestParams rp = new RequestParams();
rp.put("pLat", "SELECT officer_name FROM iwmp_officer");
client.post("http://10.0.2.2/conc5.php", rp, new AsyncHttpResponseHandler() {
public final void onSuccess(String response) {
// handle your response here
ArrayList<String> User_List = new ArrayList<String>();
try {
/* here I need output in an array,
and only names not the "officer_name" */
} catch (Exception e) {
tx.setText((CharSequence) e);
}
//tx.setText(User_List.get(1));
}
@Override
public void onFailure(Throwable e, String response) {
// something went wrong
tx.setText(response);
}
});
}
我上面显示的输出是字符串,需要在数组中获取。请帮忙!