title: Passing variable from one fragment to another
body: <p>I currently having two fragments hosted in same activity. I want to pass string variable from fragment 1 to fragment 2. I try to use bundle but I'm getting null values only.</p>
  
  <p>Fragment 1 Code :</p>
  
  <pre><code>public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      View v = inflater.inflate(R.layout.customer_one,container,false);
      edemail = v.findViewById(R.id.ed_email);
      btn = v.findViewById(R.id.btn_next);
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              email = edemail.getText().toString().trim();
              Customer_Frag2 cf2 = new Customer_Frag2();
              Bundle data = new Bundle();
              data.putString("Email",email);
              cf2.setArguments(data);
              FragmentTransaction ft = getFragmentManager().beginTransaction();
              ft.replace(R.id.layout_one,cf2);
              ft.addToBackStack(null);
              ft.commit();
          }
      });
      return v;
  }
  </code></pre>
  
  <p>Fragment 2 Code : </p>
  
  <pre><code>public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      View v = inflater.inflate(R.layout.customer_two,container,false);
      tc = v.findViewById(R.id.txt);
      Bundle args = getArguments();
      if(args != null){
          String myvalue = args.getString("Email");
          tc.setText(myvalue);
      }
      return v;
  }
  </code></pre>
  
  <p>Other than using bundle,I also tried to use interface but couldn't get the string from fragment 1.</p>