Null FragmentTransaction being passed to TabListener.onTabSelected()
<p>I'm adding navigation tabs to an action bar using the sample code provided here:
<a href="http://developer.android.com/guide/topics/ui/actionbar.html">http://developer.android.com/guide/topics/ui/actionbar.html</a>  I'm using ActionBarSherlock.</p>

<p>My TabListener is copied directly from the docs.</p>

<pre><code>    public static class TabListener&lt;T extends Fragment&gt; implements ActionBar.TabListener {
    private Fragment mFragment;
    private final Activity mActivity;
    private final String mTag;
    private final Class&lt;T&gt; mClass;

    /** Constructor used each time a new tab is created.
      * @param activity  The host Activity, used to instantiate the fragment
      * @param tag  The identifier tag for the fragment
      * @param clz  The fragment's Class, used to instantiate the fragment
      */
    public TabListener(Activity activity, String tag, Class&lt;T&gt; clz) {
        mActivity = activity;
        mTag = tag;
        mClass = clz;
    }

    /* The following are each of the ActionBar.TabListener callbacks */

    public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
        // Check if the fragment is already initialized
        if (mFragment == null) {
            // If not, instantiate and add it to the activity
            mFragment = Fragment.instantiate(mActivity, mClass.getName());
            ft.add(android.R.id.content, mFragment, mTag);
        } else {
            // If it exists, simply attach it in order to show it
            ft.attach(mFragment);
        }
    }

    public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
        if (mFragment != null) {
            // Detach the fragment, because another one is being attached
            ft.detach(mFragment);
        }
    }

    public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
        // User selected the already selected tab. Usually do nothing.
    }
}
</code></pre>

<p>And I set up the listener in my activity:</p>

<pre><code>    ActionBar.Tab tab = actionBar.newTab();
    tab.setText(getString(R.string.TAB_CALC));
    tab.setTabListener(new TabListener&lt;StrokeSelectorFragment&gt;(this, "blah", StrokeSelectorFragment.class));
    actionBar.addTab(tab);
</code></pre>

<p>But the app blows up with a null pointer exception because a null FragmentTransaction is being passed to onTabSelected() in the listener. Should I be creating one somewhere?</p>

<p>I've been over and over the docs, and I'm pretty confused. Can you see what I've missed?</p>
