Disable Specific Page in ViewPager
<p>In my app, I have Three "Tabs" that manages the view pager. </p>

<p>On top of the second view pager. I have a button that prevents the second "tab" from being selected, because I only have 2 Fragments that I want to show user.</p>

<p>Picture Instagram, the middle button is the camera button, but the left and the right tabs are for displaying fragments. I would like to achieve the same.</p>

<pre><code>public class TabBarActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        supportRequestWindowFeature(Window.FEATURE_ACTION_BAR);
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_tab_bar);

        FragmentStatePagerItemAdapter fragmentStatePagerItemAdapter = new FragmentStatePagerItemAdapter(getSupportFragmentManager(),
                FragmentPagerItems.with(this)
       .add(R.string.TABBAR_1_TITLE, ProfileFragment.class)
       .add(R.string.TABBAR_2_TITLE, BlankFragment.class)// I would like to disable this page  
       .add(R.string.TABBAR_3_TITLE, StatisticFragment.class)
                        .create());

        ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
        viewPager.setAdapter(fragmentStatePagerItemAdapter);
        viewPager.addOnPageChangeListener(this);


        SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewPagerTab);
        viewPagerTab.setViewPager(viewPager);
    }

    }
</code></pre>

<p>ANy ideas please?</p>

<p>I would like to have a Button on top of the second Tab, that is why I want to disable the second page.</p>

<p>P.S.: I am using this library <a href="https://github.com/ogaclejapan/SmartTabLayout" rel="nofollow noreferrer">https://github.com/ogaclejapan/SmartTabLayout</a></p>

<p>Something like this:</p>

<p><a href="https://i.stack.imgur.com/C3t3B.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3t3B.jpg" alt="enter image description here"></a></p>