Hello. I'm just a beginner and ask not to judge strictly and help. The problem is that I have 5 buttons on the BottomNavigationBar and the question is how to implement the switch, that is, so that by pressing the button other information is displayed, do I need to create other activities? Further I provide the code.
package --------; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; public class Navigation extends AppCompatActivity { private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.navigation_home: return true; case R.id.navigation_lists: return true; case R.id.navigation_sale: return true; case R.id.navigation_maps: return true; case R.id.navigation_regulation: return true; } return false; } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_navigation); BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation); navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); } } It may be very simple, but I need help. Thank you in advance.
BottomNavigationBartypically used to switch fragments. - post_zeew