Hi I am trying to populate a ListView in the android app. I have the data in a JsonArray, But it doesn't work to directly use the JsonArray. Any suggestions How to populate the ListView?
JSONObject json = null;
try {
json = new JSONObject(client.getResponse());
JSONArray nameArray = json.names();
JSONArray valArray = json.toJSONArray(nameArray);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, valArray));
I am trying to have "valArray", but it doesn't work. Also I wonder what does valarray contain? (JsonArray, what does it contain)