public async void DownloadPoisListAsync() { POIService service = new POIService(); if (!service.isConnected(activity)) { Toast toast = Toast.MakeText(activity, "Not conntected to internet. Please check your device network settings.", ToastLength.Short); toast.Show(); poiListData = DbManager.Instance.GetPOIListFromCache(); } else { progressBar.Visibility = ViewStates.Visible; poiListData = await service.GetPOIListAsync(); //Clear cached data DbManager.Instance.ClearPOICache(); //Save updated POI data DbManager.Instance.InsertAll(poiListData); } progressBar.Visibility = ViewStates.Gone; poiListAdapter = new POIListViewAdapter(activity, poiListData); this.ListAdapter = poiListAdapter; ListView.Post(() => { ListView.SetSelection(scrollPosition); }); }
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //LifeCycle protected override void OnCreate(Bundle bundle) { //Call SuperClass OnCreate base.OnCreate(bundle); //Log.Info(GlobalApp.TAG, "OnCreate()"); // Set our view from the "POIList" layout resource SetContentView(Resource.Layout.POIList); // request an LocationService instance _locMgr = GetSystemService(Context.LocationService) as LocationManager; // Hooking up POIListViewAdapter _poiListView = FindViewById<ListView>(Resource.Id.poiListView); _adapter = new POIListViewAdapter(this); _poiListView.Adapter = _adapter; //hook _poiListView up the event handler. _poiListView.ItemClick += POIClicked; }