title: How to create base fragments so that child fragment can extend from them to set an adapter in the OnCreateView function?
body: <p>I have an abstract base fragment class that extends from fragment. Monitor list fragment extend from this base fragment. I need to set individual adapters in each fragment because the data in the fragments are different. Problem is, the monitor list fragment only returns 1 fragment with no data?</p>
  
  <p><strong>In BaseFragment</strong></p>
  
  <pre><code>public abstract class BaseFragment extends Fragment {
      private ArrayList&lt;CholesterolMonitor&gt; objectList;
      private int mColumnCount = 1;
  
  
  public void setObjectList(String listKey){
          if (getArguments()!=null){
              this.objectList= getArguments().getParcelableArrayList(listKey);
  
  
          }
  
  @Override
      public View onCreateView(LayoutInflater inflater,ViewGroup parent, Bundle savedInstanseState)
      {
          View view = provideYourFragmentView(inflater,parent,savedInstanseState);
          // Set to recycler view
          if (view instanceof RecyclerView) {
              Context context = view.getContext();
              RecyclerView recyclerView = (RecyclerView) view;
              if (mColumnCount &lt;= 1) {
                  recyclerView.setLayoutManager(new LinearLayoutManager(context));
              } else {
                  recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
              }
  
          }
  
          return view;
  
      }
          }
  </code></pre>
  
  <p><strong>In monitor list fragment</strong></p>
  
  <pre><code>@Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View v = super.onCreateView(inflater, container,
                  savedInstanceState);
          //Set individual adapter
          monitor_list = getObjectList();
          if (v instanceof RecyclerView) {
              RecyclerView recyclerView = (RecyclerView) v;
              adapter = new MonitorListRecyclerAdapter(monitor_list, this.getContext());
              recyclerView.setAdapter(adapter);
  
  
          }
          return v;
      }
  </code></pre>