setonnavigationItemSelectedListener déprécié

you can try setonItemSelectedListener. 
It is working same as setOnNavigationItemSelectedListener()
[tested in android 11]

bnv.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            int id = item.getItemId();
            switch(id){
              //check id
            }
            return true;
        }
    });
    
Kotlin:
bnv.setOnItemSelectedListener { item ->
            when (item.itemId) {
            }
            true
        }
android developer