I use this code to check a fragment before showing it. What can you say about it?int backStackEntryCount = getFragmentManager().getBackStackEntryCount();if (backStackEntryCount > 0){    String newFragmentTag = fragment.getClass().getSimpleName()+|+fragment.getArguments();    String nowShowFragmentTag = getFragmentManager().findFragmentById(R.id.main_activity_fragment_container).getTag();    if (!newFragmentTag.equals(nowShowFragmentTag)) {        getFragmentManager()                .beginTransaction()                .replace(R.id.main_activity_fragment_container, fragment, fragment.getClass().getSimpleName()+|+fragment.getArguments())                .addToBackStack(fragment.toString())                .commit();    }}
Check fragment for exclude show same fragment again
java;android