Rotate device counter how a launch
Closed this issue · 3 comments
When the device is rotated counts as a launch
I set code to count once only into onCreate()
if (savedInstanceState == null) {
Apprate...
}
I retrieve error:
04-21 17:09:36.234 E/ActivityThread: Performing stop of activity that is not resumed: {app.descubrirosona.lite/app.descubrirosona.lite.MainActivity}
java.lang.RuntimeException: Performing stop of activity that is not resumed: {app.descubrirosona.lite/app.descubrirosona.lite.MainActivity}
Yes that's right and your solution, checking the savedInstanceState works for me. Where exactly is your error appearing?
With the current structure it is not possible for me to detect orientation changes. I could ask for the savedInstanceState but I think your solution is cleaner.
I solved, put code into onPostResume
and check mSavesIntanceState is true o false
private boolean mSavesInstanceState = false;
onCreate() {
....
if (savedInstanceState != null) mSavesInstanceState = true;
..}
onPostResume() {
...
if (mSavesInstanceState) apprate
...
}