when I read document about asyntask, they say that: “should not” update UI thread in doInbackground because doInbackground work on different thread.
that means : this action will dangerous because UI Thread isn’t thread-safe. I understand it. but when I try for test what happen when I update UI Thread in this function. I receive error: (but error doesn’t not look like because aysnchonize, but because we CANNOT do it)
(TextView)((Activity)context).findViewById(R.id.text)).setText("StackOverFlow");
//context: reference of context object of UI Thread
Please explain for me. Does we shouldn't or mustn't .
thanks 🙂
what I have understand so far with android is…,
we can’t update UI thread from background thread.
May be it is the case they have stopped us to update UI from background thread.
The reason for that is very clear… @ OS level there will be so many thread will be running.
And also
different thread from different application, And in that case It will be chaos on the screen, if we can update UI from bg-thread