2
我基本上是在這封郵件的底部做代碼帖子。 foobar()將事件發佈到公共狀態機中。 我也有觸發屏幕事件發佈到公共狀態機。 這是真的,通過使用處理程序我沒有同步問題? (即,我的狀態機不會因爲觸摸甚至是foobar事件而同時發出消息)?Android處理程序,定時器和多線程
private Handler handler = new Handler();
handler.postDelayed(runnable, 100);
private Runnable runnable = new Runnable() {
@Override
public void run() {
/* do what you need to do */
foobar();
/* and here comes the "trick" */
handler.postDelayed(this, 100);
}
};