我有一系列postDelayed處理程序。我無法設置一個停止處理程序的方法,當用戶在任何他想要的時間點擊停止按鈕時。如何停止系列postDelayed處理程序
我會感謝任何人能夠提供幫助。 感謝
while (!lessonIsRunning) {
Handler handler0 = new Handler();
handler0.postDelayed(new Runnable() {
@Override
public void run() {
plate1.setVisibility(ImageView.VISIBLE);
plate2.setVisibility(ImageView.VISIBLE);
plate3.setVisibility(ImageView.VISIBLE);
}
}, 6000);
Handler handler1 = new Handler();
handler1.postDelayed(new Runnable() {
@Override
public void run() {
apples1.setVisibility(ImageView.VISIBLE);
}
}, 9000);
Handler handler2 = new Handler();
handler2.postDelayed(new Runnable() {
@Override
public void run() {
plus1.setVisibility(TextView.VISIBLE);
}
}, 9250);
}
public void stopLesson(View V){
}
你爲什麼要使用多個處理程序?爲什麼不是一個處理程序? – CommonsWare 2013-03-05 17:09:00