public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; }
/** Returns a new instance of this fragment for the given section number. */ public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); int id; switch (sectionNumber) { case 1: id = R.drawable.coke_zero_751ml; break; case 2: id = R.drawable.coke_zero_can; break; default: id = R.drawable.coke_zero_2l; break; } args.putInt(ARG_BACKGROUND_ID, id); fragment.setArguments(args); return fragment; }