I wanted te delay the interstitial with 1 second after clicking on a button. I used Thread.sleep() but it didnt work coz the message that it must be shown after clicking the button is also delayef. I want to click on the button and wait the message 1 secobd then show the ad.
Maybe this is what you are looking for:
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
showMessage();
...
}
}, ms);
That will delay the operations in run() for the specified ms in milliseconds.
You can use Handler with postDelay. pass duration in milliseconds then run() will call after given duration.
Handler h = new Handler();
Runnable r = new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
// code that will run after 1 second(1000 ms)
}
};
h.postDelayed(r, 1000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With