开发者

Computer Turn, Wait and delay in Android 2.2

开发者 https://www.devze.com 2023-01-27 14:15 出处:网络
I am making a Poker game in Android, I have made some TextViews and ImageViews to show on the cards of player and computer and the Community cards..

I am making a Poker game in Android, I have made some TextViews and ImageViews to show on the cards of player and computer and the Community cards..

Now the problem is tha开发者_JS百科t when a player takes its turn after that it calls a method of call_computer and all the implementation of the computer executes but there is no delay between the player and computer turn.

So a player takes its turn and just after that a card is displayed. What I want is after the player turn, the computer should wait for a while and then it would display a text:

"Computer Selects Check/Fold/Raise"

and then according to the action selected the card should be displayed....

I have called a call_computer function just after the player's turn and action performed.. and I put that method in a new thread and put a sleep of 5 sec, but still no success...


You could use a call to postDelayed(Runnable, int):

long DELAY_IN_MSEC = 1000; // 1s
postDelayed(new Runnable() {
    @Override
    public void run() {
        // call_computer();
    }
}, DELAY_IN_MSEC);
0

精彩评论

暂无评论...
验证码 换一张
取 消