I was faced with an interesting problem. If you write the following code in the onCreate/onStart/onResume
method of activity:
final Button myBut
The check for thread is present only if textView
relayout is done. But the Layouting of the view is only done after OnCreate
is called . So till the Ui is not shown, changing of textView will not result in invalidating of the view.
But once the textView has been shown, the UI relayout is required, in which case the thread is checked. So you get the exception only after some time of Oncreate but not immediately.