how can you tell when an Android activity is finished loading?

后端 未结 2 1558
小蘑菇
小蘑菇 2020-12-31 04:25

I\'m in the process of working on an automated test suite for our android app, and running into trouble waiting for activities to fully load. I can call getActivity, but ju

2条回答
  •  半阙折子戏
    2020-12-31 05:19

    As I mentioned in a comment, your view hierarchy should be working after your call to setContentView() early in onCreate(). I've never had any problems like this with any activity or test class..

    I'm not sure this is of any help for this specific case, but in general you can determine when the UI event queue is empty by calling getInstrumentation().waitForIdleSync(). That'll block until there's no more UI events to process.

提交回复
热议问题