page 226-227 (Russion version)
Class CrimeFragment extends Fragment {
public void onCreate(){
UUID crimeId = (UUID) getArguments().getSerializable(CONST); //==> there is mistake
because we read arguments before they were setting;
}
public static CrimeFragment newInstance(){
Bundle args = new bundle();
ards.putSerializable(CONST);
CrimeFragment fragment = new CrimeFragment();
fragment.setArguments(args); //=>> we here setting arguments but not onCreate
events
return fragment;
}
}
------------- Solved ----------------
I create global variable in class CrimeFragment and assign argument from CrimeActivity.
I know it’s not good idea, because if there were many parametrs from CrimeActivity we must to add variable or create array.
Is there other way for this case?