title: How to set active item in the Action Bar drop-down navigation?
body: <p>I'm trying to fix the issue with restarting activity on orientation changes.</p>
  
  <p>I have an <code>ActionBar</code> with drop-down list navigation and after every rotation first element of this list is being activated. Keeping <code>fragment</code> content wasn't difficult, but I don't know how to set active list item.</p>
  
  <p>Here is the definition of <code>ActionBar</code>:</p>
  
  <pre><code>getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  ArrayAdapter&lt;CharSequence&gt; list = ArrayAdapter
      .createFromResource(this, R.array.action_list, android.R.layout.simple_dropdown_item_1line);
  list.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  getActionBar().setListNavigationCallbacks(list, this);
  </code></pre>
  
  <p>And here is my workaround:</p>
  
  <pre><code>@Override
  public boolean onNavigationItemSelected(int itemPosition, long itemId) {
      if (!application.isRotated) {
          application.activePosition = itemPosition;
          application.activeId = itemId;
          getFragmentManager().beginTransaction()
              .replace(android.R.id.content, MyFragment.newInstance(itemPosition))
              .commit();
      } else {
          application.isRotated = false;
          this.onNavigationItemSelected(application.activePosition, application.activeId);            
      }
      return true;
  }
  
  @Override
  protected void onStop() {
      super.onStop();
      application.isRotated = true;
  }
  </code></pre>
  
  <p>I'm not sure it's the best solution though.</p>