Search code examples
javaandroidandroid-fragmentsandroid-fragmentactivity

Changing orientation of the device refreshes the fragments activities


I realized a problem in my app, I use BottomNavigation with FragmentActivities, the problem was that when clicking one of the 5 FragmentActivities. 5 activities are [Home, Search, Post, Notifications & Profile] if I click any of them being in portrait state and change the device orientation to landscape the activities refreshes and start to [Home] screen always.

How do I fix this?


Solution

  • maybe you can try add configuration in your main_activity in manifest

    <activity 
    android:name=".your.main_activity"
    android:configChanges="keyboardHidden|orientation|screenSize"/>