July 2018
Intermediate to advanced
266 pages
7h 11m
English
It's a good opportunity to take a practical approach in order to further understand why the UI thread of an Android application should not be blocked. Let's add this simple block of code to MainActivity, and run the application again:
override fun onResume() { super.onResume() Thread.sleep(5000)}
This will block the UI thread for five seconds. If you run the application again, you will notice how the screen is completely white during those five seconds. This would be dreadful for the user of the application.
Read now
Unlock full access