The Android UI toolkit is not thread-safe and must always be manipulated on the UI thread.
What is thread safe?
In computer programming, thread-safe describes a program portion or routine that can be called from multiple programming threads without unwanted interaction between the threads
In other words, you can’t deal with any widgets or UI components in other thread unless the main thread, because the widgets are not prepared to be called from multiple thread, they are not thread safe.
Android offers several ways to access the UI thread from other threads:
- View.postDelayed(Runnable, long)
For more complex codes, Android 1.5 offers a new utility class, called AsyncTask.