4
When I need to update a field on the UI, I need to run this code on the UI thread?
For example: I have to change my layout Activity.
The code I’m using is this:
RunOnUiThread(() =>
{
_layoutBlurred.Visibility = ViewStates.Visible;
_layoutBlurred.Background = image;
_layoutContent.Visibility = ViewStates.Invisible;
_listViewScheduling.Enabled = false;
});
Or even a simple text exchange of a Textview:
_txtStatus.Text = GetString(Resource.String.app_online);
It is necessary to use the RunOnUiThread()
in these cases or not?
You have to use Runonuithread, but I think there is a smarter concept for this which is Asynctasks, after a look at this link: http://www.devmedia.com.br/asynctask-workwith asynchronous tasks/29823
– mcamara
There is another question that talks more about Asynctask, I think it adapts more in this your scenario! https://answall.com/questions/68056/thread-ou-asynctask-quando-e-qual-devo-usar
– mcamara