Created
November 24, 2022 08:41
-
-
Save ibrahim-mrq/d2a53c827558e14243aac1915be50954 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void replaceFragment(Fragment fragment, @StringRes int title) { | |
| // binding.main.appbar.tvTool.setText(title); | |
| // FragmentManager manager = getSupportFragmentManager(); | |
| FragmentManager manager = ((FragmentActivity) context).getSupportFragmentManager(); | |
| FragmentTransaction transaction = manager.beginTransaction(); | |
| transaction.replace(R.id.main_nav_host_fragment, fragment); | |
| transaction.addToBackStack("TAG"); | |
| transaction.commit(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment