title: Setting a subtitle on my Toolbar from a fragment
body: <p>I am having some trouble setting the sub-title in my Toolbar from my fragment. I keep getting a Null Pointer Exception at the setSubTitle. </p>
  
  <pre><code>@Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
      getActivity().getActionBar().setSubtitle("About"); // NULL POINTER EXCEPTION here
  }
  </code></pre>
  
  <p>Adding the toolbar to the host activity:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      toolbar = (Toolbar) findViewById(R.id.toolbar);
      if (toolbar != null) {
          Log.w("Rakshak", "Toolbar is not null");
  
          setSupportActionBar(toolbar);
      }
  }
  </code></pre>
  
  <p>My style.xml</p>
  
  <pre><code> &lt;style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
      &lt;item name="colorPrimary"&gt;#1A7E99&lt;/item&gt;
      &lt;item name="colorPrimaryDark"&gt;#16657A&lt;/item&gt;
      &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
      &lt;item name="windowActionBar"&gt;false&lt;/item&gt;        
  &lt;/style&gt;
  </code></pre>
  
  <p>Here is the Logcat:</p>
  
  <pre><code>11-12 11:24:15.580: E/AndroidRuntime(22183): FATAL EXCEPTION: main
  11-12 11:24:15.580: E/AndroidRuntime(22183): java.lang.NullPointerException
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at com.driverdesignstudio.drvr.About.onActivityCreated(About.java:63)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.app.Fragment.performActivityCreated(Fragment.java:1703)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:903)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.app.BackStackRecord.run(BackStackRecord.java:694)
  11-12 11:24:15.580: E/Androidenter code hereRuntime(22183):     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.os.Handler.handleCallback(Handler.java:800)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.os.Handler.dispatchMessage(Handler.java:100)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.os.Looper.loop(Looper.java:194)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at android.app.ActivityThread.main(ActivityThread.java:5371)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at java.lang.reflect.Method.invokeNative(Native Method)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at java.lang.reflect.Method.invoke(Method.java:525)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
  11-12 11:24:15.580: E/AndroidRuntime(22183):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Do I have to make interface listeners and listen to the fragment start and stop in my Fragment Activity to set subtitles or is there an easier way to set subtitles in my toolbar from my fragments. </p>
  
  <p>Let me know if you need to see any more of my code. </p>
  
  <p>Cheers.</p>