public void onSuccess(String response) { try{ JSONObject obj=new JSONObject(response); if(obj!=null){ Toast.makeText(getApplicationContext(), response, Toast.LENGTH_LONG).show(); JSONArray data=obj.getJSONArray("RetrieveSupplierRegistrationDetailsResult"); details=obj.getJSONArray(TAG_RESULT); for(int i=0;i<data.length();i++) { JSONObject c = data.getJSONObject(i); if(c.getString("iSupplierID")!="0") { String SUPPLIER_NAME = c.getString(TAG_NAME); String PRIMARY_SERVICE_CATEGORY = c.getString(TAG_PRIMARY); String SECONDARY_SERVICE_CATEGORY = c.getString(TAG_SECONDARY); HashMap<String, String> list = new HashMap<String, String>(); list.put(TAG_NAME, SUPPLIER_NAME); list.put(TAG_PRIMARY, PRIMARY_SERVICE_CATEGORY); list.put(TAG_SECONDARY, SECONDARY_SERVICE_CATEGORY); detailList.add(list); lv=(ListView) findViewById(R.id.listView1); ListAdapter adapter = new SimpleAdapter(SupplierDetails.this, detailList,R.layout.list_view, new String[] { TAG_NAME, TAG_PRIMARY,TAG_SECONDARY }, new int[] { R.id.name,R.id.primary, R.id.secondary }); // Toast.makeText(getApplicationContext(), SUPPLIER_NAME, Toast.LENGTH_SHORT).show(); lv.setAdapter(adapter); } } } }catch(JSONException e){ e.printStackTrace(); }
lv.notifyDataSetChanged();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)