Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PokemonOverviewFragment extends Fragment {
- private Pokemon pokemon; // will be null after a destroy recreate but your good because you got null checks!!
- public static PokemonOverviewFragment newInstance(Pokemon pokemon) {
- PokemonOverviewFragment fragment = new PokemonOverviewFragment();
- fragment.setPokemon(pokemon);
- return fragment;
- }
- public void setPokemon(Pokemon pokemon) {
- this.pokemon = pokemon;
- }
- @Override
- public void onResume() {
- super.onResume();
- if (pokemon != null) {
- // do your thing
- } else {
- // do something else like toast the user and exit
- }
- }
- }
Add Comment
Please, Sign In to add comment