Code example for FragmentActivity

Methods: onBackPressed

0
    @Override 
    public void onBackPressed() { 
  
        // Return to previous page when we press back button 
        if (this.pager.getCurrentItem() == 0) 
            super.onBackPressed(); 
        else 
            this.pager.setCurrentItem(this.pager.getCurrentItem() - 1); 
  
    } 
  
} 
Experience pair programming with AI  Get Codota for Java