是否有可能要等到敬酒完成恢复的方法? [英] Is it possible to wait until a toast has finished to resume the method?

查看:127
本文介绍了是否有可能要等到敬酒完成恢复的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的方法之一,我有一个面包显示,如果用户提供了正确的输入。不过,我不希望下一个图像显示,直至敬酒完毕。

如果我用视频下载(3000)如果不允许面包来显示的UI活动是睡着了。

的什么,我试图做一个例子:

 公共无效校正(){
        如果(correctionBoolean ==真){
            Toast.makeText(这一点,!正确的,Toast.LENGTH_SHORT).show();
            如果(Toast.time ==完){
            NEXTIMAGE();}
            }


解决方案

我不相信会有任何方式举杯做到这一点。如果你只是想表明一个人你是正确的窗口中,我会使用AlertDialog用一个积极的好吧按钮考虑简单。

它甚至有可能表明没有按钮的对话,有一个非UI线程睡眠了一会儿,然后关闭对话框。

In one of my methods, I have a toast that appears if the user gives the correct input. However, I do not want the next image to display until the toast has finished.

If I use Thread.sleep(3000) if does not allow the toast to show as the UI activity is asleep.

An example of what I am trying to do:

public void correction(){
        if(correctionBoolean == true){  
            Toast.makeText(this, "Correct!", Toast.LENGTH_SHORT).show();    
            if(Toast.time == finished){
            NextImage();}
            }

解决方案

I don't believe there would be any way to do this with a toast. If you are simply trying to show someone a "You're Correct" Window, I would consider simply using an AlertDialog with a single positive Okay button.

It would even be possible to show a dialog with no buttons, have a non-UI thread sleep for a bit and then dismiss the dialog.

这篇关于是否有可能要等到敬酒完成恢复的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆