Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamerin Android ListView is not populating when setting Adapter in a callback mathod

anoopmanoopm USMember
edited September 2013 in Xamarin.Android

am trying to populating ListView by loading data using a Web Service.

And i set code for setting ListView Adapterin the CallBack Method. But Adapter GetView Override method is not firing in this case & ListView is not populating.

But it works when i set adapter inOnCreate(Bundle bundle) Method with dummy data.
Anybody know what i missed ? Do i need call any UI Update method here?

  protected List<Product> Products { get; set; }

  protected void FillProductListCallBack(List<Product> products)
  {
    if (products.Any())
    {
     Products = products;
     ProductListView = FindViewById<ListView>(Resource.Id.lstList);
     ProductListView.Adapter = new ProductScreenAdapter(this, Products);
     ProductListView.SetBackgroundColor(Color.Red);
    }
  }
Sign In or Register to comment.