/** * Add fragment on top of the current one * * @param frag */ public void addFragment(int containerId, Fragment frag) { if (containerId > 0) { getSupportFragmentManager() .beginTransaction() .add(containerId, frag) .addToBackStack(null) .commit(); if (getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(false); // Hide keyboard by default BaseUIHelper.hideKeyboard(this); } }
/** * Change to new fragment * * @param frag */ public void setFragment(int containerId, Fragment frag) { if (containerId > 0) { getSupportFragmentManager() .beginTransaction() .replace(containerId, frag) .addToBackStack(null) .commit(); if (getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(false); // setSupportProgressBarIndeterminateVisibility(false); // Hide keyboard by default when changing fragment BaseUIHelper.hideKeyboard(this); } }