Solution to “Tabhost Inside a navigationDrawer not updated after orientation changes”

I came across another weird problem that i had TabHost inside Navigation Drawer and it works fine when loaded but while i change the orientation of the Android Device it displays nothing(..there might be the same case for other configuration changes as well).

There is a simplest solution to this. You need to change FragmentPagerAdapter instead of FragmentStatePagerAdapter in your TabHost class.

i.e. Change
public static class TabsAdapter extends FragmentPagerAdapter implements TabHost.OnTabChangeListener, ViewPager.OnPageChangeListener

to

public static class TabsAdapter extends FragmentStatePagerAdapter implements TabHost.OnTabChangeListener, ViewPager.OnPageChangeListener

Hope this Helps!!!

About the Author

has written 32 stories on this site.

One Comment on “Solution to “Tabhost Inside a navigationDrawer not updated after orientation changes””

  • shyam wrote on 3 September, 2015, 7:12

    It saved my day, Thank you buddy!!!

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

*

Copyright © 2017 Programmer to Programmer- A website for web programming and mobile application programming tutorials.
Wordpress themes