title: Dynamic TextView on ActionBar
body: <p>I need to implement a TextView in the ActionBar. This TextView shows the status of the bluetooth connection so it will update depending of this status.</p>
  
  <p>I'm not talking about changing ActionBar's title, but adding a textview f.e. under the title or at the right side.</p>
  
  <p>At the moment, what I have done is create an item in the menu.xml:</p>
  
  <pre><code>&lt;item
      android:id="@+id/statusTextview"
      android:actionViewClass="android.widget.TextView"
      android:showAsAction="ifRoom"
      android:title="Disconected" /&gt;
  </code></pre>
  
  <p>Then Add it on the mainActivity:</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.bluetooth, menu);
      return true;
  }
  @Override
  public boolean onPrepareOptionsMenu(final Menu menu) {
      final MenuItem menuItem = menu.findItem(R.id.statusTextview);
      tvStatus = (TextView) menuItem.getActionView();
      return super.onPrepareOptionsMenu(menu);
  }
  </code></pre>
  
  <p>But It isn't working correctly. At first time should show <code>Disconnected</code> status and doesn't show nothing. Then when the status changes and the textview must update, it throws a <strong>NPE</strong>.</p>