Code example for Fragment

Methods: getArgumentsonCreate

0
	static String[] colors = { "#ffc682", "#bbe5f9", "#d9eab6", "#f2fafe",
			"#c4e29d" }; 
 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		id = this.getArguments().getInt("id");
	} 
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		final View view = inflater.inflate(R.layout.list_fragment, container,
				false); 
		mListView = (ListView) view.findViewById(R.id.list);
		mListView.setOnItemClickListener(this);
		int bg = Color.parseColor(colors[id]);
		Log.d("slide", "" + id);
		view.setBackgroundColor(bg);
		return view;