OnDestinationChangedListener doesn't work

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bottomNavigationView = findViewById(R.id.bottomNavigationView);
    NavController navController = Navigation.findNavController(this, R.id.fragment);
    NavigationUI.setupWithNavController(bottomNavigationView, navController);
    

    navController.addOnDestinationChangedListener(new NavController.OnDestinationChangedListener() {
        @Override
        public void onDestinationChanged(@NonNull NavController controller, @NonNull NavDestination destination,
                                         @Nullable Bundle arguments) {
            if (destination.getId() == R.id.infoFragment) {
                Toast.makeText(MainActivity.this, "lol", Toast.LENGTH_SHORT).show();
            }
            Toast.makeText(MainActivity.this, "lol", Toast.LENGTH_SHORT).show();
        }
    });

This is from activity that hosts all the fragments. It is not displaying anything. What could be the problem?