Activity_WindowFocusChanged is somewhat of a special event. If you investigate the generated main.java code, you'll find that when the application is paused, mostCurrent is set to null. Activity_WindowFocusChanged can be called even if the application is paused, meaning you cannot access any of your variables during that time.