| 1 |
/** |
| 2 |
* A placeholder fragment containing a simple view. |
| 3 |
*/ |
| 4 |
public static class PlaceholderFragment extends Fragment { |
| 5 |
/** |
| 6 |
* The fragment argument representing the section number for this |
| 7 |
* fragment. |
| 8 |
*/ |
| 9 |
private static final String ARG_SECTION_NUMBER = "section_number"; |
| 10 |
|
| 11 |
/** |
| 12 |
* Returns a new instance of this fragment for the given section |
| 13 |
* number. |
| 14 |
*/ |
| 15 |
public static PlaceholderFragment newInstance(int sectionNumber) { |
| 16 |
PlaceholderFragment fragment = new PlaceholderFragment(); |
| 17 |
Bundle args = new Bundle(); |
| 18 |
args.putInt(ARG_SECTION_NUMBER, sectionNumber); |
| 19 |
fragment.setArguments(args); |
| 20 |
return fragment; |
| 21 |
} |
| 22 |
|
| 23 |
public PlaceholderFragment() { |
| 24 |
} |
| 25 |
|
| 26 |
@Override |
| 27 |
public View onCreateView(LayoutInflater inflater, ViewGroup container, |
| 28 |
Bundle savedInstanceState) { |
| 29 |
View rootView = inflater.inflate(R.layout.${fragmentLayoutName}, container, false); |
| 30 |
<#if hasSections?has_content> |
| 31 |
TextView textView = (TextView) rootView.findViewById(R.id.section_label); |
| 32 |
textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER))); |
| 33 |
</#if> |
| 34 |
return rootView; |
| 35 |
} |
| 36 |
} |