Creating Fragments in Android?
<pre><code>@Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        if(tab.getPosition()==0)
        {
            FragmentA frag = new FragmentA();
            ft.replace(android.R.id.content, frag);

        }
        else
        {
            FragmentB frag = new FragmentB();
            ft.replace(android.R.id.content, frag);
        }
    }
</code></pre>

<p>The above code loads in fragments, the problem is it creates a new instance of each fragment, so going to and from tabs, the fragment reloads. What is the best way to make it so it does not create a new instance of each fragment eahc time and only uses the origial instance?</p>

<p>Thanks</p>
