RunOnUiThread(i) is like an AsyncTask or a pascal thread?, i can execute io operations with out affect the UI?
One use for RunOnUiThread(i) is to allow a background/worker thread to passed data to the UI. A background thread should not call methods on UI controls directly since they were not designed to be thread safe. For example, if a worker thread is used to receive data from an HTTP connection, and you want to display the information in the UI, the thread can call RunOnUiThread(i) to execute UI code which displays the data by calling methods on UI controls.
https://developer.android.com/guide/components/processes-and-threadsAdditionally, the Android UI toolkit is not thread-safe. So, you must not manipulate your UI from a worker thread—you must do all manipulation to your user interface from the UI thread. Thus, there are simply two rules to Android's single thread model:
Do not block the UI thread
Do not access the Android UI toolkit from outside the UI thread
AsyncTask is a wrapper around a background/worker thread and callback which passes a result to the UI thread. It can be used in a similar way:
https://developer.android.com/reference/android/os/AsyncTaskBut according to the linked page, AsyncTask has bugs and has been deprecated
"AsyncTask was intended to enable proper and easy use of the UI thread. However, the most common use case was for integrating into UI, and that would cause Context leaks, missed callbacks, or crashes on configuration changes. It also has inconsistent behavior on different versions of the platform, swallows exceptions from doInBackground, and does not provide much utility over using Executors directly."