Does anyone know the difference between pressing the power button and the home button? In my application, I tried to put instructions for debugging in each activity life cycle, and both results coincide, that is, the activity will be onPause and onRestart will be enabled then onResume when the activity opens again (if we press home or earlier, when we turn on the device again, by pressing the power button (if we press the power button earlier).
Having the same behavior / sequence, I expected the camera app to work the same in both cases. But this is not so. I used viewview for preview. If you press the home button and then open the application again, it will work fine.
BUT, if I press the power button, and then press it again to turn it on again, the surface will freeze, and in addition, the preview freezes. But the camera actually still works (if I press the camera button, it still takes a photo).
So, I'm really stuck with the difference between the two ...
EDIT:
After testing and testing, I found that the difference is that when I press the home button, the application will be onPause (), and then the surface will be destroyed. On the other hand, if I press the power button, the View surface will not be destroyed.
Still confused about what causes two different behaviors, though ...
source
share