Code example for Spinner

Methods: setAdaptersetPrompt, setSelection

0
	 * @param choices : a string array of spinner choices 
	 * @param tag : an enum tag to use for retrieving this spinner's selection 
	 * @return the spinner created 
	 */ 
	public Spinner spinner(String txt, String[] choices, Enum<?> tag) {
		Spinner spinner = new Spinner(mParent.getContext());
		spinner.setPrompt(txt);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(mParent.getContext(),
                android.R.layout.simple_spinner_item, choices);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
 
		mData.mView = spinner;
		mData.mTag = tag;
		mParent.mFormLinks.put(tag, spinner);
		if (mParent.inState != null) {
			int choice = mParent.inState.getInt(
					"spinner_"+tag.getClass().getSimpleName()+"_"+tag.name());
			spinner.setSelection(choice == AdapterView.INVALID_POSITION ? 0 : choice);
		} 
		return spinner;
	} 
	 
	/**