I am trying to pass a data from a clickable TextView to EditText between the fragments. Right now I am able to navigate to the other fragment when clicking the TextView. This is the coding of CategoryFragment
:
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
Toast.makeText(
getActivity().getApplicationContext(),
listDataHeader.get(groupPosition)
+ " : "
+ listDataChild.get(
listDataHeader.get(groupPosition)).get(
childPosition), Toast.LENGTH_SHORT)
.show();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
HomeFragment fragment = new HomeFragment();
fragmentTransaction.replace(R.id.frame_container, fragment);
fragmentTransaction.commit();
return false;
}
I feel that this can be done because the toast is able to retrieve the string inside the listDataChild
. What I can't seem to solve overnight is that how to retrieve the listDataChild
strings and pass it, from Fragment 1 to Fragment 2, where Fragment 2 contains one EditText box. How can I put the string from textview to edittext?