title: fragment error android studio
body: <p>I am trying to do a tabbed activity with 3 fragments android studio but my code crash when I try to go to another tab.</p>
  
  <p>The problem I believe in this part but I'm not able to solve it</p>
  
  <pre><code>   @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState)
      {
  
          if (getArguments().getInt(ARG_SECTION_NUMBER) ==1)
          {
              View rootView = inflater.inflate(R.layout.fragment_fragment_settings, container, false);
              return rootView;
          }
          else if (getArguments().getInt(ARG_SECTION_NUMBER)== 2)
          {
              View rootView = inflater.inflate(R.layout.fragment_main, container, false);
              return rootView;
          }
          else
          {
              View rootView = inflater.inflate(R.layout.fragment_fragment_courses, container, false);
              TextView textView = (TextView) rootView.findViewById(R.id.section_label);
              textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));
              return rootView;
          }
      }
  } 
  </code></pre>
  
  <p>`  </p>