Is there a way I can delay an if statement for 1 sec before running the other if condition? I tried using a run-able handler for each statement but it crashes the app, I also used Thread.sleep(1000); but it just freezes the UI. How do I solve this?
This is how I first used the handler
final Handler Internet_handler = new Handler();
final Runnable internet = new Runnable() {
public void run() {if (EseCards_Slot1.isShown()) {
EseCards_Slot1.performClick();
bot_count++;
Stop_Two_InstantPLay(); // stops 2 cards from playing i.e pick 2 and ride on
botThinkdelay();// delays the if statement
}
}
};
Internet_handler.postDelayed(internet, 1700);
if (EseCards_Slot1.isShown()) {
EseCards_Slot1.performClick();
bot_count++;
Stop_Two_InstantPLay(); // stops 2 cards from playing i.e pick 2 and ride on
botThinkdelay();// delays the if statement
}
if (EseCards_Slot2.isShown()) {
EseCards_Slot2.performClick();
bot_count++;
Stop_Two_InstantPLay();
botThinkdelay();
}
if (EseCards_Slot3.isShown()) {
EseCards_Slot3.performClick();
bot_count++;
Stop_Two_InstantPLay();
botThinkdelay();
}
if (EseCards_Slot4.isShown()) {
EseCards_Slot4.performClick();
bot_count++;
Stop_Two_InstantPLay();
botThinkdelay();
}
if (EseCards_Slot5.isShown()) {
EseCards_Slot5.performClick();
bot_count++;
Stop_Two_InstantPLay();
botThinkdelay();
}
if ((bot_count>0)&&(Ese_Turn_toPlay==true)) {
Market.performClick();
bot_count=0;
botThinkdelay();
}