title: I get android.content.res.Resources$NotFoundException: Resource ID #0x0 when I try to parse a layout
body: <p>I created an activity and inside this activity I have different fragments. In a fragment I want to check if user is logged in, if is logged in display a layout if it's not logged in display another.</p>
  
  <p>here is what I did, can you please look over?</p>
  
  <pre><code>public class MyProfileFragment extends Fragment {
      private FirebaseAuth mAuth;
      private int layoutPicked;
      @Override
      public void onStart() {
  
          super.onStart();
          mAuth = FirebaseAuth.getInstance();
          if(mAuth.getCurrentUser() == null) {
              layoutPicked = R.layout.layout_myprofile;
          }
          else {
             layoutPicked = R.layout.layout_myprofilelogged;
          }
      }
  
          @Nullable
          @Override
          public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
              View view = inflater.inflate(layoutPicked, container, false);
  
  
  
  
              return view;
          }
  
  
  
  
  
  }
  
  
  </code></pre>
  
  <p>and here is the error I get</p>
  
  <blockquote>
    <p>E/AndroidRuntime: FATAL EXCEPTION: main
        Process: #########, PID: 562
        android.content.res.Resources$NotFoundException: Resource ID #0x0
            at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
            at android.content.res.Resources.loadXmlResourceParser(Resources.java:2281)
            at android.content.res.Resources.getLayout(Resources.java:1175)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
            at com.example.drivie.HomeActivityFragments.MyProfileFragment.onCreateView(MyProfileFragment.java:34)
            at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
            at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
            at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
            at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
            at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
            at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
            at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
            at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
            at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
            at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
            at android.os.Handler.handleCallback(Handler.java:883)
            at android.os.Handler.dispatchMessage(Handler.java:100)
            at android.os.Looper.loop(Looper.java:214)
            at android.app.ActivityThread.main(ActivityThread.java:7356)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)</p>
  </blockquote>