Grace Hanusha
Grace Hanusha

Reputation: 11

Robolectric idleMainLooper explanation

Robolectric idleMainLooper() I want to know specifically the usage of this function and its functionality.

ShadowLooper.idleMainLooper();

If I use a line as above what is likely to happen?

Upvotes: 1

Views: 1113

Answers (1)

Alex Florescu
Alex Florescu

Reputation: 5151

This is what idle does according to docs.

Causes Runnables that have been scheduled to run immediately to actually run. Does not advance the scheduler's clock

You would use this on a Looper that you have shadowed. So idleMainLooper will just do exactly that on the main looper. Code is here

Upvotes: 1

Related Questions