BottomNavigationView를 사용하고 계신거죠?
아래 링크에 보시면 BottomNavigationView.setOnNavigationItemSelectedListener 메소드가 있습니다.
https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView#setOnNavigationItemSelectedListener(com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener)
setOnNavigationItemSelectedListener는 BottomNavigationView.OnNavigationItemSelectedListener를 세팅하도록 되어 있는데, OnNavigationItemSelectedListener를 보면 아래처럼 메소드가 하나 존재합니다.
public static interface BottomNavigationView.OnNavigationItemSelectedListener
public abstract boolean onNavigationItemSelected (MenuItem item)
onNavigationItemSelected의 리턴값이 boolean인데, 문서에 이렇게 나와있습니다.
Returns
boolean true to display the item as the selected item and false if the item should not be selected. Consider setting non-selectable items as disabled preemptively to make them appear non-interactive.
true 를 리턴하면 클릭한 메뉴아이템이 선택된 상태로, false면 선택되지 않은 됩니다.