title: Navigation Drawer onNavigationDrawerItemSelected called before MainActivity onCreate?
body: <p>I have setup a new project with the template implementation of Navigation Drawer Fragment and a MainActivity.</p>
  
  <p>It provides me with the following relevant methods:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      Intent intent = getIntent();
      token = intent.getStringExtra(EXTRA_TOKEN);
  
      mNavigationDrawerFragment = (NavigationDrawerFragment)
              getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
      mNavigationDrawerFragment.activityMain = this;
  
      mTitle = getTitle();
  
      // Set up the drawer.
      mNavigationDrawerFragment.setUp(
              R.id.navigation_drawer,
              (DrawerLayout) findViewById(R.id.drawer_layout));
  }
  </code></pre>
  
  <p>My MainActivity is started by a splash activity which gets a saved access token via the EXTRA_TOKEN.</p>
  
  <p>This is the override of the Navigation Drawer item select listener in the MainAcitivity:</p>
  
  <pre><code>@Override
  public void onNavigationDrawerItemSelected(int position) {
      // update the main content by replacing fragments
      FragmentManager fragmentManager = getSupportFragmentManager();
      onSectionAttached(position + 1);
  
      switch(position) {
          case 0:
              fragmentManager.beginTransaction()
                      .replace(R.id.container, FeedFragment.newInstance(token, ""))
                      .commit();
              break;
  
          case 1:
              fragmentManager.beginTransaction()
                      .replace(R.id.container, PeopleFragment.newInstance("", ""))
                      .commit();
              break;
  
          case 2:
              if(qbloggedin) {
                  fragmentManager.beginTransaction()
                          .replace(R.id.container, MessagesFragment.newInstance(token, ""))
                          .commit();
              }
              break;
  
          default:
              break;
      }
  }
  </code></pre>
  
  <p>It starts three different fragments depending on which item is selected in the NavDrawer. While instantiating the new fragments, the <code>token</code> string is passed into its constructor, which is saved in the fragment's class for further use.</p>
  
  <p>On the first start of the App however, it seems that <code>onNavigationDrawerItemSelected</code> is called before <code>onCreate</code>! This results me passing a null value token into the fragments, causing them to be all messed up.</p>
  
  <p>How is this possible? As I understand it, the NavigationDrawerFragment should not have been setup yet!</p>
  
  <p>I set breakpoints on both <code>onCreate</code> and on <code>onNavigationDrawerItemSelected switch position = 0</code>. <code>onNavigationDrawerItemSelected</code> is indeed hit before <code>onCreate</code>.</p>
  
  <p>How can I make sure to get the token first before trying to handle the <code>onNavigationDrawerItemSelected</code>?</p>
  
  <p>Any help would be appreciated.</p>