2015-11-13 88 views

回答

5

根據Handlerthe documentation

公衆最終無效removeCallbacks(Runnable接口R)

在API級別1

刪除Runnable r的所有待處理文章,即ar e在消息隊列中。

示例代碼:

Runnable runnable = new Runnable() { 
    public void run() { 
     Log.i("Tag", "Runnable running!"); 
    } 
}; 

Handler handler = new android.os.Handler(); 
handler.postDelayed(runnable, 1000); 

handler.removeCallbacks(runnable); 
相關問題