public async void DownloadPoiListAsync() { progressBar.Visibility = Android.Views.ViewStates.Visible; poiListData = GetPoiListTestData(); progressBar.Visibility = Android.Views.ViewStates.Gone; listAdapter = new POIListViewAdapter(this, poiListData); poiListView.Adapter = listAdapter; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.POIList); _poiListView = FindViewById <ListView> (Resource.Id.poiListView); _adapter = new POIListViewAdapter(this); _poiListView.Adapter = _adapter; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.POIList); _locationManager = GetSystemService(Context.LocationService) as LocationManager; _poiListView = FindViewById <ListView>(Resource.Id.poiListView); _listViewAdapter = new POIListViewAdapter(this); _poiListView.Adapter = _listViewAdapter; _poiListView.ItemClick += OnPOIClicked; }
public async void DownloadPoisListAsync() { progressBar.Visibility = ViewStates.Visible; POIService service = new POIService(); if (!service.isConnected(this)) { Toast toast = Toast.MakeText(this, "Not conntected to internet.Please check your device network settings.", ToastLength.Long); toast.Show(); } else { poiListData = await service.GetPOIListAsync(); progressBar.Visibility = ViewStates.Gone; poiListAdapter = new POIListViewAdapter(this, poiListData); poiListView.Adapter = poiListAdapter; } }
private async void DownloadPoisListAsync() { if (!IsConnected()) { Toast toast = Toast.MakeText(this, "Not conntected to internet. Please check your device network settings.", ToastLength.Short); toast.Show(); return; } progressBar.Visibility = ViewStates.Visible; poiListData = await new POIService().GetPOIListAsync(); progressBar.Visibility = ViewStates.Gone; poiListAdapter = new POIListViewAdapter(this, poiListData.Pois); poiListView.Adapter = poiListAdapter; poiListView.Post(() => { poiListView.SetSelection(scrollPosition); }); }