There is no real difference, except that the View.post is helpful when you don't have a direct access to the activity.

 

    public boolean post(Runnable action) {
       Handler handler;
        if (mAttachInfo != null) {
           handler = mAttachInfo.mHandler;
      } else {
            // Assume that post will succeed later
           ViewRoot.getRunQueue().post(action);
           return true;
        }

        return handler.post(action);
    }

 

 

    public final void runOnUiThread(Runnable action) {
        if (Thread.currentThread() != mUiThread) {
            mHandler.post(action);
        } else {
            action.run();
        }
    }

 

相关文章:

  • 2021-04-10
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2021-07-30
  • 2021-04-13
猜你喜欢
  • 2021-06-10
  • 2022-12-23
  • 2021-11-30
  • 2021-07-25
  • 2021-05-05
  • 2022-12-23
  • 2021-08-01
相关资源
相似解决方案