Wednesday, December 11, 2013

Display Data as ListView in Android

here we have a string jSon values in in productList arrayList labeled as TAG_PID,TAG_NAME and we are going to display our data as list view
but actually it's View of many activities that activities only have two values here one is TAG_PID,TAG_NAME here so here i'm calling list_item layout for store data one by one
AroundMe.this a name of this class

public void run() {
                    /**
                     * Updating parsed JSON data into ListView
                     * */
                    ListAdapter adapter = new SimpleAdapter(
                            AroundMe.this, productsList,
                            R.layout.list_item, new String[] {
                            TAG_PID,TAG_NAME},
                            new int[] {R.id.pid, R.id.name });
                    // updating listview
                    setListAdapter(adapter);

                }

No comments:

Post a Comment