BottomNavigationView selected menu id not same as xml item id

Viewed 100

I want to change my current fragment due to selected menu item

My view:

override fun onBottomNavigationItemClick(): Observable<MenuItem> =
    news_feed_router_navigation.itemSelections()

My presenter:

addSubscription(getView()!!.onBottomNavigationItemClick().subscribe {
    when (it.itemId) {
        R.id.menu_newsfeed -> getView()?.showNewsFeed()
        R.id.menu_reports -> getView()?.showReports()
        R.id.menu_chats -> getView()?.showChats()
        R.id.menu_profile -> getView()?.showProfile()
    }
})

My menu xml:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/menu_newsfeed"
        android:icon="@drawable/ic_home" />

    <item
        android:id="@+id/menu_reports"
        android:icon="@drawable/ic_widgets_black_24dp" />

    <item
        android:id="@+id/menu_chats"
        android:icon="@drawable/ic_chat" />

    <item
        android:id="@+id/menu_profile"
        android:icon="@drawable/ic_profile" />

</menu>

But when I check MenuItem.itemId, id is not which I am looking for:

enter image description here

0 Answers
Related