Async in Android Studio [closed]

Why do you want to use that runOnUiThread() inside onCreate() method..??
onCreate() will be called on ui thread only. There is no use to call runOnUiThread() inside onCreate() method.

If you want in some other place, that method start’s with small letter. So type small ‘r’ instead of Capital ‘R’.

Use below code :

  runOnUiThread(new Runnable() {
        @Override
        public void run() {

        }
    });

And you should not implement any UI related code inside doInBackground(). If you want to update UI after completion of doInBackground(), add those line of code inside onPostExecute().

Leave a Comment