How to use Spinner to Save selection to shared preference
<p>I have a spinner view called <code>Spinner_Gender</code>, I made array, array adapter and made <code>onItemSelectedListener</code>.  I want to save the selected item position which is integer to shared preference, I tried using a string with Editor and putInt, it saved well.  But when reloading the saved data to the spinner using <code>.setSelection</code> it gives an error because it wants an integer not string.  Also while trying Integer in sharedpreference I can't save the selected item position to it because the putInt needs only a string to put int in.</p>

<p>Sorry for long question but I searched a lot and can't find answer.  Two more questions please:
what is the integer name for spinner <code>selectedItemPosition</code>? How can I store it to <code>sharedpreference</code>?</p>

<p>Code:</p>

<pre><code>final Spinner spinner = (Spinner) findViewById(R.id.Spinner_Gender);
spinner.setAdapter(adapter); 
spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { 
      public void onItemSelected(AdapterView&lt;?&gt; parent, View itemSelected, 
                                final int selectedItemPosition, long selectedId) 
      { 
          int selectedPosition = spinner.getSelectedItemPosition(); 
          Editor editor = mGameSettings.edit(); 
          editor.putInt(myNum,selectedPosition); 
          editor.commit(); 
      }
}
</code></pre>
