Fill ListView from dataset

Sascha1234Sascha1234 USMember
edited May 2015 in Xamarin.Android

Hi,

I want load data in ListView from dataSet.

in my example only load First item from dataset, how load all items?

// contactSelect is storedProcedure return(personID,personName)....

        DataSet ds = myWebService.ContactSelect();   

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    itemsNew = new List<string>();
                    itemsNew.Add(ds.Tables[0].Rows[i]["personID"].ToString() + "-" + ds.Tables[0].Rows[i]["personName"].ToString());
                    ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, itemsNew);
                    myListView.Adapter = adapter;
                }



         This example work fine:

                items = new string[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
                ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, items);
                myListView.Adapter = adapter;

Any solution?

Tagged:

Best Answer

Answers

  • Sascha1234Sascha1234 USMember

    reasonably, tnx mate

Sign In or Register to comment.