0

I am using a fragment that contains one TextView and two NumberPicker to handle as a single reusable component (DATAPICKER). One number picker is for units and the other one is for decimals, and text view for title.

My activity contains instructions text, three fragments (DATAPICKER) and one button, and correctly displays the layout.

How to send parameters values to each fragment corresponding to its title and max/min values for internal number pickers?

1 Answers1

0

in the activity:

Bundle args = new Bundle();
Fragment frag = new Fragment();
args.putInt("name", num);
frag.setArguments(args);
fragmentTransactionFinish.add(R.id.TextView1, frag);
fragmentTransactionFinish.commit();

in the fragment:

Bundle args = getArguments();
int num = args.getInt("num", -1); \\ -1 is the default if no number
                                              was entered in the activity
dor00012
  • 362
  • 4
  • 17