title: Nested fragments with viewpager and bottom navigation
body: <p>i am stuck at nested fragments , some one please guide me a little bit. i am in learning phase...</p>
  
  <p>actually i am using a bottomNavigationView and popluate fragments and when selecting an item, one fragment has a view pager and tab layout in it, and loading list data from fire base. the problem is that when a fragment with viewpager in it selected, data fetched successfuly but not populated in list view, but when i swite view pages the listview is populated . any one please help me for this problem or guide me where to put network calls in fragment or something else solution of it.</p>
  
  <p>First Fragment which have Viewpager in .</p>
  
  <pre><code>public class explore extends Fragment {
  
  public static explore Instance = null;
  private TabLayout tabLayout;
  private ViewPager viewPager;
  private Activity activity;
  private Context context;
  private PagerAdapter pagerAdapter;
  
  public static explore getInstance() {
      if (Instance == null) {
          Instance = new explore();
      }
      return Instance;
  }
  
  public explore() {
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      activity = (Activity) getActivity();
      context = getActivity();
      return inflater.inflate(R.layout.fragment_explore, container, false);
  }
  
  @Override
  public void onViewCreated(@NonNull View v, @Nullable Bundle savedInstanceState) {
      tabLayout = v.findViewById(R.id.tabs_Explore);
      viewPager = v.findViewById(R.id.viewpager_Explore);
      tabLayout.setupWithViewPager(viewPager);
  }
  
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
      List&lt;Category&gt; categories = new FirebaseHelper(getActivity()).getCategoriesList();
      pagerAdapter = new PagerAdapter(getChildFragmentManager(), categories);
      viewPager.setAdapter(pagerAdapter);
      super.onActivityCreated(savedInstanceState);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>pager's first fragment means(ChildFragment)</p>
  
  <pre><code>public class categories extends Fragment {
  
  private static categories Obj = null;
  
  
  private RecyclerView listView;
  
  private List&lt;Category&gt; categoryList;
  
  private CategoryAdapter categoryAdapter;
  
  
  public categories() {
      categoryList = new ArrayList&lt;&gt;();
  }
  
  public static categories getInstance() {
      if (Obj == null) {
          Obj = new categories();
      }
      return Obj;
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View v = inflater.inflate(R.layout.fragment_blank, container, false);
      listView = v.findViewById(R.id.mRecycler);
      listView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
      listView.setHasFixedSize(true);
      SnapHelper helper = new LinearSnapHelper();
      helper.attachToRecyclerView(listView);
      categoryAdapter = new CategoryAdapter(getActivity(), categoryList);
      listView.setAdapter(categoryAdapter);
  
  
      return v;
  }
  
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
      Bundle bundle = getArguments();
      if (bundle != null) {
          categoryList = bundle.getParcelableArrayList("data");
          categoryAdapter.notifyDataSetChanged();
  
      }
      super.onActivityCreated(savedInstanceState);
  }
  </code></pre>
  
  <p>}</p>