简体   繁体   English

如何刷新屏幕或在后台运行初始过程

[英]How can I refresh my screen or run initial process in background

My main screen has a process which can take 20-30 seconds to load the information on to the screen. 我的主屏幕有一个过程,可能需要20-30秒才能将信息加载到屏幕上。 While this is happening the screen is just black. 虽然这种情况正在发生,但屏幕只是黑色。 I have tried using a ProgressDialog to let the user know the process is running but as the screen is black you cannot see it. 我尝试使用ProgressDialog让用户知道进程正在运行,但由于屏幕是黑色的,你无法看到它。 Can I refresh the screen so that the dialog is visible or do I need to run my initial process in background so that the screen is visible? 我可以刷新屏幕以使对话框可见,还是需要在后台运行我的初始过程以便屏幕可见?

Anything that takes over ~200ms should be run as a background task. 任何超过200毫秒的事情都应该作为后台任务运行。 You can either use an AsyncTask or a Thread / Handler combination. 您可以使用AsyncTaskThread / Handler组合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM