title: How to move from Bottom Navigation Bar to activity android
body: <p>I add to my app Bottom Navigation Bar it's work but the problem now I want move from one button in  Bottom Navigation Bar to activity that activity have to fragment to view (TabLayout,ViewPager).
  When I try to make it like that   selectedFragment = new MainActivityOderLIstFargmant(); the show me error like that ..
  and also like that and also not work.. startActivity(new Intent(NafMain.this, MainActivityOderLIstFargmant.class));</p>
  
  <p><a href="https://i.stack.imgur.com/bjBTq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bjBTq.png" alt="enter image description here"></a></p>
  
  <p>I need to move to other activity to show two (TabLayout,ViewPager).</p>
  
  <p>this activity I want to move to it ..</p>
  
  <pre><code>public class MainActivityOderLIstFargmant extends AppCompatActivity {
      TabLayout tabLayout;
      ViewPager viewPager;
      PageAdapterOrderList pageAdapterOrderList;
      TabItem tabChats;
      TabItem tabCalls;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_mani_order_list);
          tabLayout = findViewById(R.id.tablayout);
          tabChats = findViewById(R.id.tabChats);
          tabCalls = findViewById(R.id.tabCalls);
          viewPager = findViewById(R.id.viewPager);
  
          pageAdapterOrderList = new PageAdapterOrderList(getSupportFragmentManager(), tabLayout.getTabCount());
          viewPager.setAdapter(pageAdapterOrderList);
          viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
  
      }
  }
  
  
  </code></pre>
  
  <p>from here </p>
  
  <pre><code>public class NafMaintest extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_naf_main);
          BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
              BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
              bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
                  @Override
                  public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
                      Fragment selectedFragment = null;
                      switch (menuItem.getItemId()) {
                          case R.id.nav_home:
                             selectedFragment = new MainActivityOderLIstFargmant();//I try like that but not work 
                              break;
                          case R.id.nav_favorites:
                              selectedFragment = new FragmentHome();
                              break;
                          case R.id.nav_search:
                              selectedFragment = new FragmentProfile();
                              break;
                          case R.id.nav_s:
                              selectedFragment = new MainActivity();
                              break;
                      }
                      getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                              selectedFragment).commit();
                      return true;
  
                  }
              });
  
          if (savedInstanceState == null) {
              getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                      new FragmentHome()).commit();
          }
      }
  
  
  
  }
  
  
  
  </code></pre>
  
  <p>If anyone know how solution it help me </p>