Android onCreate is called after locking the screen

android, android-lifecycle, lifecycle, locking, oncreate

Solution

For me I've

android:configChanges="orientation"

but this doesn't help because my activity was full screen and so I added

android:configChanges="keyboardHidden|orientation|screenSize"

in the activity tag

As mentioned in Handling the Configuration Change Yourself

If your application doesn't need to update resources during a specific configuration change and you have a performance limitation that requires you to avoid the activity restart, then you can declare that your activity handles the configuration change itself, which prevents the system from restarting your activity.

Problem

When I lock the screen while my app is running "on top", the system calls almost immediately onCreate (screen is still black). What could be the reason for this destructive behaviour?

Original source