0

Currently working on a school project where i have a TabbedPage app (Xamarin.form), i have three tabs one for home , second for a listview (it gets data from a database) and a third one for the user profile.

I enabled the PullToRefresh option for the Listview, it works, but in my case data is updated every 2 - 3 minutes , so i have to implement an auto refresh thing. I thinked about updating the listview source on the appearing of the page (OnAppearing) but it does not work.

any Suggestions ? thanks :)

Khalil Yamoun
  • 133
  • 1
  • 4

1 Answers1

0

A really simple way, you could start a thread within your Page to perform data refreshing.

Something like this will get you started

var myRefreshThread = new Thread (new ThreadStart (async delegate {
   while (true) {
       // Perform your data fetch 

       InvokeOnMainThread ( () => {
          // Update the UI on the UIthread
       });

       await Task.Delay (180000);
   }
})).Start ();
SushiHangover
  • 73,120
  • 10
  • 106
  • 165