android sdk 關(guān)于android中postDelayed方法的講解?
關(guān)于android中postDelayed方法的講解?這是一個(gè)可以創(chuàng)建多線程消息的函數(shù)。首先,創(chuàng)建一個(gè)handler object handler=new handler()2,然后創(chuàng)建一個(gè)runna
關(guān)于android中postDelayed方法的講解?
這是一個(gè)可以創(chuàng)建多線程消息的函數(shù)。首先,創(chuàng)建一個(gè)handler object handler=new handler()2,然后創(chuàng)建一個(gè)runnable object runnable=new runnable(){@override public void run(){//todo auto-generated method stub//為此,每兩秒鐘再次調(diào)用一次這個(gè)runnable對(duì)象來實(shí)現(xiàn)計(jì)時(shí)器操作處理程序.postDelayed(this,2000)}3,使用postdayed方法,在兩秒鐘內(nèi)調(diào)用Runnable對(duì)象。處理程序.postDelayed(runnable,實(shí)際上實(shí)現(xiàn)了2S的定時(shí)器。4如果你想關(guān)掉計(jì)時(shí)器,你可以這樣做handler.removeCallbacks文件(可運(yùn)行)