title: Nested fragments getchildfragmentmanager causing crash
body: <p>I have viewPager which contains fragments each of these fragment has viewpager to display Images and banners</p>
  
  <p>now to each fragment Image adapter I am passing  getChildFragmentManager() as below</p>
  
  <pre><code>CarouselAdapter carouselAdapter = new CarouselAdapter(getChildFragmentManager());
  </code></pre>
  
  <p>But above code is causing crash while changing viewpager tabs showing following message</p>
  
  <pre><code>java.lang.IllegalArgumentException: No view found for id 0x7f1000ef 
  </code></pre>
  
  <p>But if I pass getFragmentManager() it is not crashing but adapter goes blank for some time any Idea how to handle nested fragments. </p>
  
  <p>I am using FragmentPagerAdapter for both viewpagers but still its not working</p>
  
  <p>Following is crashlog</p>
  
  <pre><code> java.lang.IllegalArgumentException: No view found for id 0x7f1000ef (com.packagename:id/viewPagerBanners) for fragment MainBannerFragmentNew{308cb84 #0 id=0x7f1000ef android:switcher:2131755247:0}
                                                                           at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1292)
                                                                           at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1523)
                                                                           at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1585)
                                                                           at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2832)
                                                                           at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:2199)
                                                                           at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1323)
                                                                           at android.support.v4.app.FragmentManagerImpl.moveFragmentsToInvisible(FragmentManager.java:2323)
                                                                           at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2136)
                                                                           at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2092)
                                                                           at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1969)
                                                                           at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:620)
                                                                           at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
                                                                           at android.support.v4.view.ViewPager.populate(ViewPager.java:1268)
                                                                           at android.support.v4.view.ViewPager.populate(ViewPager.java:1116)
                                                                           at android.support.v4.view.ViewPager$3.run(ViewPager.java:273)
                                                                           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                                           at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                                           at android.view.Choreographer.doFrame(Choreographer.java:603)
                                                                           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                                           at android.os.Handler.handleCallback(Handler.java:746)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                           at android.os.Looper.loop(Looper.java:148)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5443)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  </code></pre>
  
  <p>Following is carousel Adapter code</p>
  
  <pre><code>public class CarouselAdapter extends FragmentPagerAdapter {
  
  private List&lt;CarouselItem&gt; carouselItemsList;
  
  public CarouselAdapter(FragmentManager fm, List&lt;CarouselItem&gt; carouselItemsList) {
      super(fm);
      this.carouselItemsList = carouselItemsList;
  
  }
  
  @Override
  public Fragment getItem(int position) {
      return MainBannerFragmentNew.newInstance(R.drawable.gray_logo, carouselItemsList.get(position));
  }
  
  @Override
  public int getCount() {
      return carouselItemsList.size();
  }
  
  @Override
  public void destroyItem(ViewGroup container, int position, Object object) {
      super.destroyItem(container, position, object);
  }
  }
  </code></pre>
  
  <p>Following is sliding tab adapter code</p>
  
  <pre><code>public class HomeTabsPagerAdapter extends FragmentPagerAdapter {
  ArrayList&lt;HomeTabItem&gt; homeTabItems;
  
  public HomeTabsPagerAdapter(FragmentManager manager, ArrayList&lt;HomeTabItem&gt; homeTabItems) {
      super(manager);
      this.homeTabItems = homeTabItems;
  }
  
  @Override
  public Fragment getItem(int position) {
      HomeTabItem homeTabItem = homeTabItems.get(position);
      return OfferZoneFragment.newInstance(homeTabItem.getId());
  
  }
  
  @Override
  public int getCount() {
      return homeTabItems.size();
  }
  
  @Override
  public CharSequence getPageTitle(int position) {
      return homeTabItems.get(position).getTitle();
  }
  }
  </code></pre>
  
  <p>Every sliding tab fragment has recyclerview this recylerview contains carousel viewpager following is the code in bindview</p>
  
  <pre><code>((BannerHolder) holder).viewPager.setAdapter(new CarouselAdapter(fragmentManager, homePageItems.get(position).carouselItems));
                  ((BannerHolder) holder).circlePageIndicator.setViewPager(((BannerHolder) holder).viewPager);
                  final float density = context.getResources().getDisplayMetrics().density;
                  ((BannerHolder) holder).circlePageIndicator.setBackgroundColor(0x00000000);
                  ((BannerHolder) holder).circlePageIndicator.setRadius(5 * density);
                  ((BannerHolder) holder).circlePageIndicator.setFillColor(ContextCompat.getColor(context, R.color.appthemecolor));
                  ((BannerHolder) holder).circlePageIndicator.setPageColor(0xFFFFFFFF);
                  ((BannerHolder) holder).circlePageIndicator.setStrokeColor(0x00000000);
                  ((BannerHolder) holder).circlePageIndicator.setStrokeWidth(2 * density);
                  if (((BannerHolder) holder).viewPager.getAdapter().getCount() &lt;= 1) {
                      ((BannerHolder) holder).circlePageIndicator.setVisibility(View.GONE);
                  } else {
                      ((BannerHolder) holder).circlePageIndicator.setVisibility(View.VISIBLE);
                  }
  </code></pre>