Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PokemonOverviewFragment extends Fragment {
- private static final String EXTRA_POKEMON = "extra_pokemon";
- private Pokemon pokemon; // will survive a destroy recreate because the Bundle it came in will be kept by the OS
- public static PokemonOverviewFragment newInstance(Pokemon pokemon) {
- PokemonOverviewFragment fragment = new PokemonOverviewFragment();
- Bundle bundle = new Bundle();
- bundle.putParcelable(EXTRA_POKEMON, pokemon);
- fragment.setArguments(bundle);
- return fragment;
- }
- @Override
- public void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- pokemon = getArguments().getParcelable(EXTRA_POKEMON);
- }
- }
Add Comment
Please, Sign In to add comment