. Advertisement .
..3..
. Advertisement .
..4..
It appears this error message: only the original thread that created a view hierarchy can touch its views. And now I am really disappointed after hours searching for a solution to it.
Please help me figure out that problem. Thanks a lot.
Solution: To fix only the original thread that created a view hierarchy can touch its views problem, I recommend the ways below:
Solution 1: The section of the background task that changes the user interface must be moved to the main thread. For this, there is a helpful piece of code:
Simply nest this within the function that executes in the background, and then paste any update-implementing code in the block’s middle. Keep the amount of code you provide as minimal as possible to avoid defeating the aim of the background thread.
Solution 2:
Add
runOnUiThread( new Runnable(){ ..
innerrun()
: