0
我期待下面的代码块写入“Hello!”每秒一次。但它写了两次。我究竟做错了什么?运行中重复两次()
handler = new Handler();
final Runnable r = new Runnable() {
public void run() {
Log.d("message", "Hello!");
handler.postDelayed(this, 1000);
}
};
handler.postDelayed(r, 1000);
runOnUiThread(r);