Consider the following code:
new Thread() { @Override public void run() { myTextView.setText("Some text"); } }.start();
On pre-Lollipop androids, this code throws a CalledFromWrongThreadException exception, but why does it work fine on Lollipop androids?
Test environment: Genymotion emulator is running Android 5.1
The code was inside the onCreateView() method of the Fragment class.
user1922137
source share