I am starting to develop applications for Android. I work with threads in android.I read about runOnUiThread , which runs the code on the main user interface (if I'm not mistaken, I think.).
My question is what is the difference between normal code on the main user interface and the code inside runOnIUThread .
Example: 1
class A { getDataFromServer(foo);
Example: 2
getActivity.runOnUiThread(new Runnable(){ @Override public void run(){ getDataFromServer(foo); } });
What is the difference in both examples. Please help me. Your answer will be new training for me.
android multithreading android-runonuithread
Mohit gaur
source share