The code I used below works well, but when the screen orientation gets changed, isback becomes false again and turns into obsolete as well.
What I've tried so far:
boolean isback =false;
fragmentShowButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        isback = true;
        fragmentsShow();
    }
});
@Override
public void onBackPressed() {     
    if(isback == true) {
         super.onBackPressed();
    } else {
        // Do nothing
    }
}
And I don't want to use isVisible methods of Fragments, because I have to check so many Fragments in one activity and I can't tag all of them.
 
     
    