byte-sized adventures.

Prevent Lifecycle Call onCreate Attribute When Configuration Changed

04 Aug 2023

In Android onCreate can be triggered for several unwanted scenarios. Such as “Screen Orientation”, “Keyboard Configuration”, etc…

To prevent this we need to declare it on AndroidManifest.xml

<activity
// Activity stuff ..
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
>