Code example for Spinner

Methods: setAdapter, setVisibility

0
	private OnCheckedChangeListener mChangRadio = new OnCheckedChangeListener() {
 
		@Override 
		public void onCheckedChanged(RadioGroup group, int checkedId) { 
			// TODO Auto-generated method stub 
			ChooseMode.setVisibility(0); 
			initSpinner(checkedId); 
 
		} 
	}; 
	 
 
	  
	 
	private void initSpinner(int checkedId) {
 
		if (checkedId == day.getId()) {
			String days[] = { "2012-11-1", "2012-11-2", "2012-11-3",
					"2012-11-4", "2012-11-5", "2012-11-6", "2012-11-7", 
					"2012-11-8", "2012-11-9", "2012-11-10" }; 
			ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
					android.R.layout.simple_spinner_item, days);
			adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
			ChooseMode.setAdapter(adapter);
			mode=1;
 
		} else { 
			String weeks[] = { "2011-11-1周", "2011-11-2周", "2011-11-3周", "2011-11-4周",
					"2011-5周", "2011-6周", "2011-7周", "2011-8周", "2011-9周", "2011-10", 
					"2011-11周", "2011-12周" }; 
			 
			ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
					android.R.layout.simple_spinner_item, weeks);
			adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
			ChooseMode.setAdapter(adapter);
          mode=2;
		} 
 
	}