Book Image

Xamarin Mobile Application Development for Android

Book Image

Xamarin Mobile Application Development for Android

Overview of this book

Table of Contents (18 chapters)
Xamarin Mobile Application Development for Android Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Hooking up POIListViewAdapter


We have the list layout and adapter ready; let's now proceed to hook up the data in poiListView. We need to switch back to the POIListActivity class and add the following changes:

  1. Declare the following variables inside the POIListActivity class:

    private ListView poiListView;
    private ProgressBar progressBar;
    private List<PointOfInterest> poiListData;
    private POIListViewAdapter poiListAdapter;
  2. Now, in the OnCreate method, instantiate the ListView and ProgressBar:

    poiListView = FindViewById<ListView> (Resource.Id.poiListView);
    progressBar = FindViewById<ProgressBar> (Resource.Id.progressBar);
  3. For now, we will create an Async method that is responsible for downloading the data from the server and displaying it in POIListActivity. Add the following method to the POIListActivity class:

    public async void DownloadPoisListAsync(){
    
    }
  4. Call the DownloadPoisListAsync() method from the OnCreate() activity life cycle callback.

  5. Note that this chapter uses the Android...