public void push ( Fragment fragment ) { Fragment top = peek ( ) ; if ( top != null ) { manager . beginTransaction ( ) . setCustomAnimations ( R . anim . enter_from_right , R . anim . exit_to_left , R . anim . enter_from_left , R . anim . exit_to_right ) . remove ( top ) . add ( containerId , fragment , indexToTag ( manager . getBackStackEntryCount ( ) + 1 ) ) . addToBackStack ( null ) . commit ( ) ; } else { manager . beginTransaction ( ) . add ( containerId , fragment , indexToTag ( 0 ) ) . commit ( ) ; } manager . executePendingTransactions ( ) ; }
Pushes a fragment to the top of the stack .