-1

This use Navigation Drawer, and use Tab, and use Fragment.

MainActivity.java

public class MainActivity extends AppCompatActivity {

    DrawerLayout myDrawerLayout;
    NavigationView myNavigationView;
    FragmentManager myFragmentManager;
    FragmentTransaction myFragmentTransaction;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);

        myNavigationView = (NavigationView) findViewById(R.id.nav_drawer) ;
        myFragmentManager = getSupportFragmentManager();
        myFragmentTransaction = myFragmentManager.beginTransaction();
        myFragmentTransaction.replace(R.id.containerView, new HomeFragment()).commit();

        myNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {

            @Override
            public boolean onNavigationItemSelected(MenuItem selectedMenuItem) {

                myDrawerLayout.closeDrawers();

                if (selectedMenuItem.getItemId() == R.id.nav_item_select1) {
                    FragmentTransaction fragmentTransaction = myFragmentManager.beginTransaction();
                    fragmentTransaction.replace(R.id.containerView, new Select1()).commit();
                }

                return false;
            }
        }
    }
}

Pyeondo.java

second
  • 4,069
  • 2
  • 9
  • 24
  • 2
    Possible duplicate of [Communicating between a fragment and an activity - best practices](https://stackoverflow.com/questions/14247954/communicating-between-a-fragment-and-an-activity-best-practices) – GovindRathod Jun 14 '18 at 13:18

2 Answers2

0

You already has fragment instance

fragment.setArguments(bundle);

and you are setting argument in that instance so don't create new one, use it

fragmentTransaction.replace(R.id.containerView, fragment).commit();
Amrat Singh
  • 331
  • 2
  • 13
0

You have to use same fragment in which you are setting bundle.

Replace new select1() with fragment

 FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        bundle.putString("Slocale1",SbtnsLocale.getText().toString());
        bundle.putString("Slocale2",SbtneLocale.getText().toString());
        bundle.putString("Sdate1",StxtsDate.getText().toString());
        bundle.putString("Sdate2",SStxtsDate.getText().toString());
        bundle.putString("Sseat",StxtSeat.getText().toString()); // use as per your need

        fragment.setArguments(bundle);
        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.replace(R.id.containerView, fragment).commit();
Mohit Madaan
  • 469
  • 2
  • 11