blob: fd4dbf99be098310ff3f9410877c49939bdafd24 [file] [log] [blame]
package ${packageName};
import android.os.Bundle;
import android.<#if appCompat>support.v4.</#if>app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
<#if applicationPackage??>
import ${applicationPackage}.R;
import ${packageName}.dummy.DummyContent;
* A fragment representing a single ${objectKind} detail screen.
* This fragment is either contained in a {@link ${CollectionName}Activity}
* in two-pane mode (on tablets) or a {@link ${DetailName}Activity}
* on handsets.
public class ${DetailName}Fragment extends Fragment {
* The fragment argument representing the item ID that this fragment
* represents.
public static final String ARG_ITEM_ID = "item_id";
* The dummy content this fragment is presenting.
private DummyContent.DummyItem mItem;
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
public ${DetailName}Fragment() {
public void onCreate(Bundle savedInstanceState) {
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_${detail_name}, container, false);
// Show the dummy content as text in a TextView.
if (mItem != null) {
((TextView) rootView.findViewById(${detail_name})).setText(mItem.content);
return rootView;