I want to parse the simple array in a ListView. my JSON Array looks like
["Java","PHP",".NET","Python"]
I want to parse the simple array in a ListView. my JSON Array looks like
["Java","PHP",".NET","Python"]
ListView listView = (ListView)findViewById(R.id.listView);
ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<String>(this,
android.R.layout.select_dialog_item,arrayList);
listView.setAdapter(stringArrayAdapter);
try {
JSONArray jsonArray = new JSONArray(str);
for(int i = 0;i<jsonArray.length();i++)
{
arrayList.add(jsonArray.get(i).toString());
}
arrayAdapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}