获得spinnar中选中的值

public class YourItemSelectedListener implements OnItemSelectedListener {   
   
    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {   
        String selected = parent.getItemAtPosition(pos).toString();   
    }   
   
    public void onNothingSelected(AdapterView parent) {   
        // Do nothing.   
    }   
}  

public class YourItemSelectedListener implements OnItemSelectedListener {

    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
        String selected = parent.getItemAtPosition(pos).toString();
    }

    public void onNothingSelected(AdapterView parent) {
        // Do nothing.
    }
}
spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());


你可能感兴趣的:(SPI)