/** | |
* A placeholder fragment containing a simple view. | |
*/ | |
public static class PlaceholderFragment extends Fragment { | |
/** | |
* The fragment argument representing the section number for this | |
* fragment. | |
*/ | |
private static final String ARG_SECTION_NUMBER = "section_number"; | |
/** | |
* 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); | |
fragment.setArguments(args); | |
return fragment; | |
} | |
public PlaceholderFragment() { | |
} | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
View rootView = inflater.inflate(R.layout.${fragmentLayoutName}, container, false); | |
<#if hasSections?has_content> | |
TextView textView = (TextView) rootView.findViewById(R.id.section_label); | |
textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER))); | |
</#if> | |
return rootView; | |
} | |
@Override | |
public void onAttach(Activity activity) { | |
super.onAttach(activity); | |
((${activityClass}) activity).onSectionAttached( | |
getArguments().getInt(ARG_SECTION_NUMBER)); | |
} | |
} |