Code example for Spinner

Methods: getSelectedItemId

0
 
	@Override 
	public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
			long arg3) {
		// TODO Auto-generated method stub 
		long selected_position = lang.getSelectedItemId();
		position = (int) selected_position;
		Locale[] locale = Locale.getAvailableLocales();		
		Toast toast = Toast.makeText(getApplicationContext(), locale[(int) position].getDisplayLanguage() , Toast.LENGTH_SHORT);
		toast.show();
		 
		//mTts.setLanguage(locale	); 
		 
	} 
 
 
	@Override 
	public void onNothingSelected(AdapterView<?> arg0) {
		// TODO Auto-generated method stub 
		 
	}