在应用程序之后,我必须保持Spinner
所选项目保持不变。项目正在从 sqlite 数据库中使用. 所以请指导我如何实现这一目标。onRestart()
onResume()
Spinner
ArrayAdapter
String myString = (String) myspinner.getSelectedItem();` //the value you want the position for
` @SuppressWarnings("unchecked")
ArrayAdapter<String> myAdap = (ArrayAdapter<String>) myspinner.getAdapter(); //cast to an ArrayAdapter
int spinnerPosition = myAdap.getPosition(myString);
//set the default according to value
myspinner.setSelection(spinnerPosition);