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);