I ran into the same problem and got stuck in it for more than a week. Then I prepared a sample APP with tabHost and reproduced the same problem in the sample application. After playing around with this, I found that this is an android tabHost error. So, I moved tabHost to FragmentTabHost and found that the problem is gone.
Modeling problems with tabHost:
Suppose there are two tabs ie A A and B
Simulation 1 (Recover Error)
- Arrival in portrait mode
- Switch to B mode in portrait mode.
- Turn B to album
- Returns to A mode in landscape orientation.
- Turn A into portrait (onConfigChanged method tabActivity will be launched, but onConfigChanged from A will not be activated)
Simulation 2 (works great)
- Arrival in mode A in portrait mode
- Go to B mode in portrait mode (keep spinning as you want, but stop in portrait mode)
- Returns to portrait mode.
- Turn A to landscape (both the onConfigurationChanged tabActivity method and A are activated)
Summary: If you return to the screen with the same orientation as you selected, the onConfigurationChanged () call is called.
source share