0

I am trying to make an app to do the following function: I need to have an ActionBar with 3 tabs such that one of the tabs has to implement a ViewPager and the other 2 tabs has to have separate layouts.Although I know how to create an ActionBar with Tabs with fragments, I am not sure how to(or if it is even possible) to implement a ViewPager inside one of the tabs.Thanks a lot for your help.

Edit:Nvm I found the solution.You have to use nested fragments.For more information refer to How to add a Fragment inside a ViewPager using Nested Fragment (Android 4.2)

Community
  • 1
  • 1
Yulric Sequeira
  • 1,452
  • 3
  • 13
  • 14
  • I thought about using the tab listener onTabSelected function to create a new ViewPager intent but that would just hide all the tabs which I don't want happening. I'm not sure how to switch between fragments and FragmentActivity when going from one tab to another.Any suggestions as to what I should try to do? – Yulric Sequeira Mar 02 '13 at 22:13
  • Unfortunately now another problem has come up: I am now able to switch between tabs(using ActionBarSherlock) and when I arrive on the tab with the ViewPager, it allows to horizontally scroll between the different fragment pages.However when I switch to another tab and come back to the ViewPager tab I get an error "java.lang.illegalStateException Activity has been destroyed.Although I know why it happens I cant think of a way of fixing it. – Yulric Sequeira Mar 04 '13 at 00:11

0 Answers0