立即吐司 [英] Toast Immediately

查看:117
本文介绍了立即吐司的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的应用下载信息时出现Toast消息,但是即使我将其放在代码之前,也要等到下载完成后才能显示.将我的代码放在一个单独的线程中会引起很多麻烦,但是将吐司放入一个单独的线程中也不起作用.无论如何,在此之前我是否可以收到此Toast消息,或者我只是必须解决头疼的问题?

I would like to have a Toast Message appear while my app is downloading information but even if I put it before my code it doesn't appear until after the download has completed. Putting my code in a separate thread causes many headaches but putting toast in a separate thread doesn't work either. Is there anyway I can have this Toast message come up before this or am I just going to have to work through the headaches?

推荐答案

无论如何,您都应该将异步下载放在单独的线程中,以免禁用主线程的UI.当您调用阻塞的I/O方法时,UI将不会响应.

You should be putting asynchronous downloads in a separate thread anyway, so as to not disable the main thread's UI. When you call a blocking I/O method, the UI will not respond.

在UI线程中处理昂贵的操作.

这篇关于立即吐司的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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