简体   繁体   中英

How to force thread to wait for gui loading on android

I start another heavy thread that play sound from android gui thread onCreate or onStart. After this gui not render, but music is playin about 20-30 seconds. Than gui rendered and everyting become normal. How i can force start my heavy thread start only after gui was rendered?

ps I actualy use monodroid

I would insist to start sound inside onResume() it is the state of Activity where Activity is in foreground, so your UI would be loaded at this stage. See the Activity LifeCycle onStart() is executed before onResume() so it might be the reason for your problem.

为什么不isUiLoaded使用布尔变量isUiLoaded ,您的工作线程应在启动之前检查此变量...'isUiLoaded'默认情况下应为false ,并且必须在加载该Activity的Activity的onStart()或OnCreate()内部分配为true用户界面。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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