Code example for Spinner

Methods: getItemAtPosition, setSelection

0
        		 
        		 
        		fillFromToSpinner(position);
        		 
        		SpinnerFrom.setSelection(0);
        		SpinnerTo.setSelection(0);
        		 
        		//If only first spinner is selected and 
        		//the from and to spinners are not clicked at all 
        		unitfrom = (String)(SpinnerFrom.getItemAtPosition(0).toString());
        		unitto = (String)(SpinnerTo.getItemAtPosition(0).toString());
        		 
        		//reset the result 
        		ResultView.setText("");
        		 
        		 
    	} 
    	else if(v.getParent() == SpinnerFrom){
    		unitfrom = (String)(SpinnerFrom.getSelectedItem().toString());	
    	}