-- Leo's gemini proxy
-- Connecting to republic.circumlunar.space:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
Further to Detecting whether an Android app is stopping (or starting), I implemented code to decide when you are leaving or entering my game Rabbit Escape.
The relevant class is called Lifecycle2SoundEvents. (Yes, it's a terrible name. Yes, I spent a long time trying to name it, and this is the best I came up with.)
And the tests, which are in TestLifecycle2SoundEvents, look like this:
@Test public void Press_the_home_button_api10_causes_pause() { Tester t = new Tester( activity1 ); => https://github.com/andybalaam/rabbit-escape/blob/d30a7fbdcb286fe4351780b1d14287f008de1ecb/rabbit-escape-render/test/rabbitescape/render/androidutil/TestLifecycle2SoundEvents.java TestLifecycle2SoundEvents t.in.onSaveInstanceState( activity1 ); t.in.onPause( activity1 ); t.in.onStop( activity1 ); // When we press home, we must at least pause (really we stop) t.assertPaused(); }
which I was reasonably pleased with, because they match my original blog post Order of Android Activity lifecycle events fairly well, without too much noise.
Originally posted at 2015-06-18 07:22:35+00:00. Automatically generated from the original post : apologies for the errors introduced.
-- Response ended
-- Page fetched on Mon May 27 18:20:43 2024