/** * "Replace" the existing Fragment with a new one using given path. We're really adding a Fragment * to the back stack. * * @param file The file (directory) to display. */ private void replaceFragment(File file) { mPath = file.getAbsolutePath(); FileListFragment fragment = FileListFragment.newInstance(mPath, mFileType); mFragmentManager .beginTransaction() .replace(android.R.id.content, fragment) .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) .addToBackStack(mPath) .commit(); }
/** Add the initial Fragment with given path. */ private void addFragment() { FileListFragment fragment = FileListFragment.newInstance(mPath, mFileType); mFragmentManager.beginTransaction().add(android.R.id.content, fragment).commit(); }