Android basics: running code in the UI thread

后端 未结 7 521
悲&欢浪女
悲&欢浪女 2020-11-22 11:55

In the viewpoint of running code in the UI thread, is there any difference between:

MainActivity.this.runOnUiThread(new Runnable() {
    public void run() {
         


        
相关标签:
7条回答
  • 2020-11-22 12:35

    There is a fourth way using Handler

    new Handler().post(new Runnable() {
        @Override
        public void run() {
            // Code here will run in UI thread
        }
    });
    
    0 讨论(0)
提交回复
热议问题