I am playing video in a full screen mode, and when I do click on back button I am able to exit full screen mode - but not able to show TextView which I have hide in case of
_isFullScreen inside public void onFullscreen(boolean _isFullScreen)
is state of full screen, if it's true it means player is gone to full screen mode and if it is false it means the player is switched back from full screen mode and this listener is called both times when you go to full screen mode and come back from full screen mode with true and false value respectively. You should modify code as below
videoPlayer.setOnFullscreenListener(new OnFullscreenListener() {
@Override
public void onFullscreen(boolean _isFullScreen) {
fullScreen = _isFullScreen;
if(_isFullScreen){
textView.setVisibility(View.GONE); // hide text as player switched to full screen mode
} else {
textView.setVisibility(View.VISIBLE); // show text as player switched back from full screen mode, changing visibility here instead of onBackPressed have advantage that even if user switches back from full screen mode using control button on player instead of press back button the text will still come to visible
}
}
});
while your onBackPressed listener will be just used for switching player back from full screen mode if player was in full screen mode when back button was pressed;
@Override
public void onBackPressed() {
if (fullScreen){
videoPlayer.setFullscreen(false);
} else{
super.onBackPressed();
}
}