Answers for "android navigation clear back stack"

3

Android Navigation component clear back stack programmatically

override fun onBackPressed() {
   val navigationController = binding.navigation.findNavController()
     if (navigationController.currentDestination?.id == R.id.homeFragment) {
         finish()
     } else {
         super.onBackPressed()
       }
}
Posted by: Guest on November-02-2021
0

clear back stack android

Intent intent = new Intent(this, A.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); 
startActivity(intent);
CurrentActivity.this.finish(); // if the activity running has it's own context


// view.getContext().finish() for fragments etc.
Posted by: Guest on February-26-2021

Code answers related to "android navigation clear back stack"

Code answers related to "Dart"

Browse Popular Code Answers by Language