Change between fragment navigation drawer viewpagerindicator-open source projects JakeWharton/ViewPagerIndicator

I have a Navigation Drawer and a ViewPagerIndicator inside the content_frame. I want to change between fragment`s from the navigation drawer but the problem is that switch between tabs ViewPager works but when I switch to another option that you have to remove the ViewPager and put a new fragment puts this fragment under the ViewPager.

Attached photo so you can see.

1) Here you can already see the new fragment below ViewPager.It can be distinguished by the text shown is Prueba

Attached code

Activity_main.xml





    

        

        
    




Method for switching between fragment.

   /** Main content by replacing fragments
 * @param position
 */
private void selectItem(int position) {
    //Code
    Fragment fragment = new TryFragment();
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

    switch (position) {
    case 0:
        mPager.setCurrentItem(0);
        break;

    case 1:
        mPager.setCurrentItem(1);
        break;

    case 2:

        ft.replace(R.id.content_frame, fragment);

        break;

    }        
    ft.commit();
    mAdapter.notifyDataSetChanged();
    //Close drawer
    mDrawerLayout.closeDrawer(mDrawerList);
}

Class TryFragment

    class TryFragment extends Fragment
{
    public static final String  ARG_PLANET_NUMBER   = "planet_number";

    public TryFragment()
    {
        // Empty constructor required for fragment subclasses
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
           TextView text = new TextView(getActivity());
            text.setGravity(Gravity.CENTER);
            text.setText("Prueba");
            text.setTextSize(20 * getResources().getDisplayMetrics().density);
            text.setPadding(20, 20, 20, 20);

            LinearLayout layout = new LinearLayout(getActivity());
            layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
            layout.setGravity(Gravity.CENTER);
            layout.addView(text);

            Log.d("TestFragment", "Estoy en el fragment");

            return layout;
    }
}

I do not know if I have to destroy the viewpager to show the new fragment or a problem of hierarchy in the xml.