[Android Software Development] adecker:
So I have created a spinner, placed it in my application, populated it and it works. I then went on to create a new class called MyOnItemSelectedListener. Here is that code:

import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;

public class MyOnItemSelectedListener implements OnItemSelectedListener {
public int i;
@Override
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
Toast.makeText(parent.getContext(), "You selected " +
parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
i = (int)parent.getItemIdAtPosition(pos);
System.out.println(i);
}

@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub

}

}

and here is my main class's code:

package de.vogella.android.temperature;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.Toast;

public class Convert extends Activity {
private EditText text;
private EditText answer;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text = (EditText) findViewById(R.id.EditText01);
answer =(EditText) findViewById(R.id.EditText02);
//RadioButton celsiusButton = (RadioButton) findViewById(R.id.RadioButton01);
//RadioButton fahrenheitButton = (RadioButton) findViewById(R.id.RadioButton02);
/* if (fahrenheitButton.isChecked()) {
celsiusButton.setChecked(false);
} else if(celsiusButton.isChecked()){
fahrenheitButton.setChecked(false);
}
*/
Spinner s = (Spinner) findViewById(R.id.spinner);
ArrayAdapter adapter = ArrayAdapter.createFromResource(
this, R.array.type, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s.setAdapter(adapter);

}

// This method is called at button click because we assigned the name to the
// "On Click property" of the button
public void myClickHandler(View view) {
switch (view.getId()) {
case R.id.Button01:
//RadioButton celsiusButton = (RadioButton) findViewById(R.id.RadioButton01);
//RadioButton fahrenheitButton = (RadioButton) findViewById(R.id.RadioButton02);
if (text.getText().length() == 0) {
Toast.makeText(
this,
"Please enter a valid number", Toast.LENGTH_LONG).show();
return;
}

float inputValue = Float.parseFloat(text.getText().toString());
MyOnItemSelectedListener listener = new MyOnItemSelectedListener();
switch(listener.i){
case 0:answer.setText(String.valueOf(convertCelciusToFahrenheit(inputValue))+" Fahrenheit");
break;
case 1:answer.setText(String.valueOf(convertFahrenheitToCelcius(inputValue))+" Celcius");
break;
case 2:answer.setText(String.valueOf(centimetersToFeet(inputValue))+" Feet");
break;
case 3:answer.setText(String.valueOf(centimetersToInches(inputValue))+" Inches ");
break;
case 4:answer.setText(String.valueOf(centimetersToMiles(inputValue))+" Miles");
break;
case 5:answer.setText(String.valueOf(cmToDecimeter(inputValue))+" Decimeters");
break;
case 6:answer.setText(String.valueOf(cmToMm(inputValue))+" Milimeters");
break;
case 7:answer.setText(String.valueOf(cToK(inputValue))+" Kelvin");
break;
case 8:answer.setText(String.valueOf(DecimetertoCm(inputValue))+" Centimeters");
break;
case 9:answer.setText(String.valueOf(decimeterToMeters(inputValue))+" Meters");
break;
case 10:answer.setText(String.valueOf(dekametersToHectometers(inputValue))+" Hectometers");
break;
case 11:answer.setText(String.valueOf(dekametersToMeters(inputValue))+" Meters");
break;
case 12:answer.setText(String.valueOf(FeetToCentimeters(inputValue))+" Centimeters");
break;

}
break;

}
}

//MORE METHODS DOWN HERE JUST DIDNT COPY AND PASTE THEM FOR SIZE SAKE.

Now at the logic part (Case 1:, Case 2: etc. etc.) something is wrong. It always does case 0 and I cant figure out why. Im sure its something stupid on my part but I cant seem to find it. Is there a different way of determining what to do based on what is selected in the spinner?