문제

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