0

There is activity, fragment and a viewmodel binded to them both. Fragment has event which gets raised multiple times by Timer, delegate inside fragment is subscribed to that event and updates single UI element with value from a viewmodel.

Delegate:

private void OnTimerUpdate(object o, EventArgs e) {
    this.Activity.RunOnUiThread(() => {TimerTextView.Text = ViewModel.TimerValue;});
}

It is called multiple times as planned, however ui element is not updating, unless I'm interacting with a View (e.g. scrolling). Previously both ui element and delegate was inside activity and was working properly, however when I refactored it to have separate fragment, this happened.

Edgar.A
  • 1,293
  • 3
  • 13
  • 26

2 Answers2

1

Have you tried calling TimerTextView.Invalidate() after changing the text?

momvart
  • 1,737
  • 1
  • 20
  • 32
0

Found answer here. Which I thought was weird, but actually worked - set width and height of textview I'm updating to some values instead of 'wrap_conent'.

Community
  • 1
  • 1
Edgar.A
  • 1,293
  • 3
  • 13
  • 26