private
void
showResult(){
try
{
Log.w(
"2"
,myJson);
JSONObject jsonObj =
null
;
jsonObj=
new
JSONObject(myJson);
Log.i(
"test"
,myJson);
JSONArray jsonArray = jsonObj.getJSONArray(TAG_JSON);
for
(
int
i=
0
;i<jsonArray.length();i++){
JSONObject item = jsonArray.getJSONObject(i);
String name = item.getString(TAG_NAME);
String brand = item.getString(TAG_BRAND);
String cat = item.getString(TAG_CAT);
HashMap<String,String> hashMap =
new
HashMap<>();
hashMap.put(TAG_NAME, name);
hashMap.put(TAG_BRAND, brand);
hashMap.put(TAG_CAT, cat);
mArrayList.add(hashMap);
}
ListAdapter adapter =
new
SimpleAdapter(
MainActivity.
this
, mArrayList, R.layout.item_list,
new
String[]{TAG_NAME, TAG_BRAND, TAG_CAT},
new
int
[]{R.id.list_name, R.id.list_brand , R.id.list_cat}
);
mListViewList.setAdapter(adapter);