title: Switch between layouts using xamarin android
body: <p>I am new to xamarin android I have given up on forms and I am wanting to change layout <code>onnavigationselecteditem</code> and was wondering if someone can point me in right direction I tried using <code>setContentView</code> but that did not change the view at all.</p>
  
  <p>There has been a layout created with the name of jobs so i no its not null I wish people would stop flagging questions with a general null statment its not the case here.</p>
  
  <pre><code> public bool OnNavigationItemSelected(IMenuItem item)
   {
          int id = item.ItemId;
  
          if (id == Resource.Id.nav_camera)
          {
              // Handle the camera action
          }
          else if (id == Resource.Id.jobs)
          {
              SetContentView(Resource.Layout.jobs);
          }
          else if (id == Resource.Id.nav_assignjob)
          {
  
          }
          else if (id == Resource.Id.nav_manage)
          {
  
          }
          else if (id == Resource.Id.nav_share)
          {
  
          }
          else if (id == Resource.Id.nav_send)
          {
  
          }
  
          DrawerLayout drawer = FindViewById&lt;DrawerLayout&gt;(Resource.Id.drawer_layout);
          drawer.CloseDrawer(GravityCompat.Start);
          return true;
      }
  </code></pre>
  
  <p>It timed out with the following</p>
  
  <blockquote>
    <p>Unhandled Exception:</p>
    
    <p>System.NullReferenceException: </p>
  </blockquote>
  
  <p>On the  <code>drawer.CloseDrawer(GravityCompat.Start);</code> line I presume because
  <code>SetContview</code> left something open but didn't display it.</p>