开发者

How do I cause the timer and compare methods to execute before my Android toast goes away?

/* In onclick function */ 

Toast.makeText(this,"y开发者_如何学JAVAou are right!",Toast.LENGTH_SHORT).show();
            timer();
            compare();
/* onclick function ends */ 

In this snippet when the dialog is popping up, the timer and compare methods are executed before the dialog goes away. How do I fix this? Can someone explain with a code snippet?

Also, I want the LENGTH_SHORT to be 400ms. How can I change that?

How can I do this simple task using alertdialog?


You can give time in miliSecond in Toast

Toast.make(this,"Hello",400).show();
 now// take one thread


Thread th=new Thread(new Runnable(){
try{
th.sleep(400);
timer();
compare();
}
catch(Exception e){
 e.getExption();  
 }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜