I want to cause my program to pause for a certain number of milliseconds, how exactly would I do this?
I have found different ways such as Thread.sleep( time )
Thread.sleep( time )
You can use the Handler class and the postDelayed() method to do that:
Handler
postDelayed()
Handler h =new Handler() ; h.postDelayed(new Runnable() { public void run() { //put your code here } }, 2000); }
2000 ms is the delayed time before execute the code inside the function