Can i use this code inside a service for calling a method with delay or Handler()
should only be used inside a UI
thread ?
What is the best way for calling a method with delay inside a service
?
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 10000ms
socket.emit("CancelTravel");
}
}, 10000);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…