Question

In my android app, I need to switch the views when Timer is elapsed.

_timer.Elapsed += (sender, e) => {
    ViewSwitcher v =  FindViewById<ViewSwitcher>(Resource.Id.switchr);
    v.ShowNext();
};

But it works on click,

 FindViewById<RelativeLayout>(Resource.Id.del).Click += (sender, e) => {
    ViewSwitcher v =  FindViewById<ViewSwitcher>(Resource.Id.switchr);
    v.ShowNext();
};

How can i make it work?

Please help, Thanks

Was it helpful?

Solution

Got it working:

RunOnUiThread (() => { 
     ViewSwitcher v =  FindViewById<ViewSwitcher>(Resource.Id.switchr);
     v.ShowNext();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top