How to stop and restart an activity in an android instrumentation test?

后端 未结 5 464
感情败类
感情败类 2021-02-01 20:43

I\'m trying to write an Android activity instrumentation test that stops (onPause(), then onStop()) and restarts the current activity. I tried

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 21:21

    A good way to test lifecycle events is through screen orientation changes. In my experience it's a convenient way to bombproof the onPause / onStart pattern.

提交回复
热议问题