安卓:确定当前上下文中显示警报 [英] Android: determining the current context to display an alert
问题描述
我打电话从斑马线扫描仪屏幕-A使用意图
秒。一旦扫描完成后,控制返回,当然,屏幕-A后面的code和我打电话屏幕-B之前做一些其他工作。
I am calling the ZXing scanner from Screen-A using Intent
s. Once the scan is done, control returns, of course, to the code behind Screen-A and I do some other work before calling Screen-B.
问题是:屏幕在此期间的工作是黑色的,我不能确定正确的上下文中使用,以显示工作...吐司/ MSGBOX。任何帮助或建议?
Problem is: the screen is black during this work period and I cannot determine the proper context to use to display a "working..." Toast/msgbox. Any help or suggestions?
推荐答案
执行你的工作时间在它自己的线程
,而线程在后台运行Android将控制权交给这将可以显示一个进度屏幕-A。 工作时间线程将消息传递到屏幕-A更新该措施的进展变量的值。这里有一个很好的开始与Android主题:
Execute your "work period" in it's own thread
, while that thread works in the background Android will pass control to Screen-A which will can display a ProgressBar. The "work period" thread will pass Messages to Screen-A updating the value of a variable that measures progress. Here's a good place to start with Android threads:
http://developer.android.com/guide/appendix/常见问题/ commontasks.html#线程
这篇关于安卓:确定当前上下文中显示警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!