Reputation: 6374
I've a problem trying to capture the onConfigurationChanged
event. This is the scenario:
onConfigurationChanged
)onConfigurationChanged
being called). Start activity B.onConfigurationChanged
) (LANDSCAPE)onBackPressed
event raised). Activity B is destroyed and A is called back.onConfigurationChanged
is not called this time.onConfigurationChanged
called.onConfigurationChanged
called.Why step 6 don't call onConfigurationChanged
event? it doesn't make sense at all. Do you know what could be the issue?
Upvotes: 4
Views: 1636
Reputation: 846
I have faced same problem and was stuck in this for more than a week. Then I have prepared a sample APP with tabHost and reproduced the same issue on the sample app. After playing around with that, I found that this is a bug of android's tabHost. So, I have migrated tabHost to FragmentTabHost and found the problem is gone.
Let, there are two tab i.e A and B
Summary: If you get back to the screen in the same orientation you got out, both onConfigurationChanged() will get called.
Upvotes: 0
Reputation: 6680
I had exactly the same issue. I still don't understand this behavior of android system, but you can use onOrientationChanged
of OrientationEventListener
instead of configuration change handling.
See this answer (example is not perfect but shows the way): https://stackoverflow.com/a/13844242/554281
Upvotes: 0