android / javaタスクがあり、JSON値を文字列配列に取得してListViewに表示したいのですが、どこから始めればよいのかわかりませんか?ありがとう。
private String[] values;
...
// this is what is returned from the web server (Debug view)
// jObj = {"success":1,"0":"Mike","1":"message 1","2":"Fred","3":"message 2","4":"John","5":"message 3"};
try {
if (jObj.getInt("success") == 1) {
.
// what i'm trying to do here is iterate thru JObj and assign values to the
// values array to populate the ArrayAdapter so that the ListView displays this:
//
// Mike: Message 1
// Fred: Message 2
// John: Message 3
//
.
this.setListAdapter(new ArrayAdapter<String>(
this, android.R.layout.simple_list_item_1, android.R.id.text1, values));
ListView listView = getListView();
}
}
catch (JSONException e) {
Log.e(TAG, e.toString());
}