How to trigger onPause programmatically in android activity
I am trying to work out how I can simulate pausing an activity for debugging my app. I want onPause to be called but NOT onStop. I just want to try a pause resume cycle and am looking for some code i can call (e.g. after a button press) to trigger this. Any ideas how? I have seen people suggest pressing the home button in other threads but when I do this is stops the app and calls onStop as well as onPause so it isn't quite what I was looking for. Taken from this link : The easiest is to add a semitransparent activity on top of your activity. I did the test myself and onStop is not called