这是一篇译文(中英对照),原文链接:Understanding Activity.runOnUiThread() When developing Android applications we always have to be mindful about our application Main Thread. 在开发Android应用时,经常需要对UI线程倍加留意. The Main Thread is busy dealing with everyday stuff such as dra…
利用Activity.runOnUiThread(Runnable)把更新ui的代码创建在Runnable中,然后在需要更新ui时,把这个Runnable对象传给Activity.runOnUiThread(Runnable). Runnable对像就能在ui程序中被调用. /** * Runs the specified action on the UI thread. If the current thread is the UI * thread, then the action is e…