I have an activity which instantiates and populates a Fragment through a adopter class. I want to pass values/objects to this Fragment adopter class so that i can dictate la
You can use Bundle to transfer data from activity to fragments or transfre data from fragment to fragment.
Bundle bundle = new Bundle();
DisplayDataList fragment = new DisplayDataList();
bundle.putString("listitem", "Buyer,Seller");
fragment.setArguments(bundle);
getFragmentManager().beginTransaction().replace(
R.id.frame_container, fragment).addToBackStack(null).commit();
Where you want to recieve that bundle i.w in DisplayDataList
Fragment class. You have to use getArguments()
method.
DisplayDataList
Bundle bundle = getArguments();
String getdata = bundle.getString("listitem");
System.out.println("Data got-->>> " + getdata);
Hope this will help you.