I have added Bottom Navigation View for my app but I need the Bottom Navigation View between activities instead of fragment so I have added this code to Java for all my 3 activities.
When I select Second or Third in my phone all things are correct but the problem is the highlight goes to the First item.
I need to highlight the item I press.
I have used fragment and it works perfectly but I am still beginner for using fragment so I am using activities.
The first activity code is:
BottomNavigationView mBottomNavigation;
    mBottomNavigation =(BottomNavigationView) findViewById(R.id.BottomNavigator);
    mBottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            switch (item.getItemId()){
                case R.id.Nav_Second:
                    Intent Second= new Intent(First.this, Second.class);
                    startActivity(Second);
                    break;
                case R.id.Nav_Third:
                    Intent Third= new Intent(First.this, Third.class);
                    startActivity(Third);
                    break;
            }
            return true;
        }
    });
}}
The second activity is:
BottomNavigationView mBottomNavigation;
    mBottomNavigation =(BottomNavigationView) findViewById(R.id.BottomNavigator);
    mBottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            switch (item.getItemId()){
                case R.id.Nav_First:
                    Intent First= new Intent(Second.this, First.class);
                    startActivity(First);
                    break;
                case R.id.Nav_Third:
                    Intent Third= new Intent(Second.this, Third.class);
                    startActivity(Third);
                    break;
            }
            return true;
        }
    });
}}
The third activity is:
BottomNavigationView mBottomNavigation;
    mBottomNavigation =(BottomNavigationView) findViewById(R.id.BottomNavigator);
    mBottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            switch (item.getItemId()){
                case R.id.Nav_First:
                    Intent First= new Intent(Third.this, First.class);
                    startActivity(First);
                    break;
                case R.id.Nav_Second:
                    Intent Second= new Intent(Third.this, Second.class);
                    startActivity(Second);
                    break;
            }
            return true;
        }
    });
}}
The xml are the same for 3 activities:
<android.support.design.widget.BottomNavigationView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/BottomNavigator"
        android:background="@color/colorPrimaryDark"
        android:layout_alignParentBottom="true"
        app:itemTextColor="@drawable/item_bg"
        app:itemIconTint="@drawable/item_bg"
        app:menu="@menu/navigate_items">
    </android.support.design.widget.BottomNavigationView> 
     
     
     
     
    