Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get
- public YourFragment newInstance(your arguments here)
- {
- Fragment fragment = new YourFragment();
- Bundle bundle = new Bundle();
- // something like this for each arg
- bundle.putArg(argKey, arg);
- fragment.setArguments(bundle);
- return fragment;
- }
- // then in onCreate get the bundle and grab the args
- @Override
- public void onCreate()
- {
- Bundle bundle = getArguments();
- arg1 = bundle.getArg(arg1Key);
- // and so on
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement