Home > Mobile >  What to do to deprecated BottomNavigationView OnNavigationItemSelectedListener?
What to do to deprecated BottomNavigationView OnNavigationItemSelectedListener?

Time:12-05

I'm trying to practice building apps with Kotlin with Android Studio, I'm using the google material design Bottom Navigation Bar.. But when I use this, I get a warning:

'setOnNavigationItemSelectedListener(BottomNavigationView.OnNavigationItemSelectedListener?): Unit' is deprecated. Deprecated in Java

So my question: How do I replaced this with a recent one? What do I do next time a come a deprecated unit like?? lastly, If I should ignore this warning and, go ahead with developing and publishing an App with it will there be consequences?? is yes, like what??

Thank you for your time and contribution in advance..

CodePudding user response:

Replace it with setonItemSelectedListener according to material documentation it has been depecrated in favor of the listeners in NavigationBarView This allows you to share selection handling code between the BottomNavigation and NavigationRail view elements, and behaves in the same way.

  • Related