سؤال

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

هل كانت مفيدة؟

المحلول

Got it working:

RunOnUiThread (() => { 
     ViewSwitcher v =  FindViewById<ViewSwitcher>(Resource.Id.switchr);
     v.ShowNext();
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top