I find that when you turn the device over or if the keyboard is hidden it Activity
is reset again, going through onCreate()
again.
A possible solution would be to use savedInstanceState
saving a state variable, but it is not the best solution.
Is it possible to somehow prevent the `Activity from reloading on rotate, or other possible events that make it reset again?
In your activity definition inside
AndroidManifest.xml
add the property:for instance:
With this it does not reload the activity when performing a rotation, it does not execute the method again
onCreate()