package com.antonyt.infiniteviewpager;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Example Fragment class that shows an identifier inside a TextView.
 * 
 */
public class ColourFragment extends Fragment {

    private int identifier;
    private int colour;

    @Override
    public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	Bundle args = getArguments();
	colour = args.getInt("colour");
	identifier = args.getInt("identifier");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	TextView v = new TextView(getActivity());
	v.setGravity(Gravity.CENTER);
	v.setTextSize(40);
	v.setTextColor(Color.BLACK);
	v.setBackgroundColor(colour);
	v.setText("Fragment ID: " + identifier);
	return v;
    }
}

@@ -1017,10 +1017,179 @@
 ;%0A    %7D%0A
+    %0A    @Override%0A    public void onSaveInstanceState(Bundle outState) %7B%0A        super.onSaveInstanceState(outState);%0A        outState.putBoolean(%22dummy%22, true);%0A    %7D%0A
 %7D%0A

Add some dummy data to save to get around android bug: http://code.google.com/p/android/issues/detail?id=19211#c5