title: How to pass changed data back to Fragment's list?
body: <p>I have a <code>ListFragment</code> with arbitrary data. When I tap on an item, it's data passes through <code>Bundle</code> to another <code>EditFragment</code>, where I retrieve it and store in <code>EditText</code> for editing. How do I pass edited data back and apply changes for the selected item in arraylist? Same way through <code>Bundle</code>? Am I supposed to access ListFragment's listview at the same time?</p>
  
  <p>EditFragment:</p>
  
  <pre><code>public class EditFragment extends Fragment {
  
      MenuItem save;
      MenuItem cancel;
      View view;
      EditText editText;
      int position;
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          setHasOptionsMenu(true);
          view = inflater.inflate(R.layout.edit_fragment_layout, container, false);
          editText = (EditText) view.findViewById(R.id.editText);
          Bundle b = getArguments();
  
          position = b.getInt("position");
  
          editText.setText(b.getString("name"));
          return view;
      }
  
      @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          inflater.inflate(R.menu.edit_fragment, menu);
  
          save = menu.findItem(R.id.save);
          cancel = menu.findItem(R.id.cancel);
  
          cancel.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
              @Override
              public boolean onMenuItemClick(MenuItem item) {
                  FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
                  MyListFragment myListFragment = (MyListFragment) getFragmentManager().findFragmentByTag("MyListFragment");
  
                  fragmentTransaction.replace(R.id.fragContainer, myListFragment);
                  fragmentTransaction.addToBackStack(null);
                  fragmentTransaction.commit();
  
                  return true;
              }
          });
  
          save.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
              @Override
              public boolean onMenuItemClick(MenuItem item) {
                  FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
                  MyListFragment myListFragment = (MyListFragment) getFragmentManager().findFragmentByTag("MyListFragment");
                  //here we need to save changed data in our arraylist
                  Bundle bundle = new Bundle();
                  bundle.putInt("position", position);
                  bundle.putString("name", editText.getText().toString());
                  myListFragment.setArguments(bundle);
                  //should I get my bundle data here?
                  Bundle b = getArguments();
  
                  //ArrayAdapter adapter = (ArrayAdapter) myListFragment.getListView().getAdapter();
  
                  fragmentTransaction.replace(R.id.fragContainer, myListFragment);
                  fragmentTransaction.addToBackStack(null);
                  fragmentTransaction.commit();
  
                  return true;
              }
          });
      }
  }
  </code></pre>