Spinner Selection - Save to SharedPreferences, then Retrieve
<p>Im using the "SharedPreferences" in my app to retain the ability to save/retrieve string values from multiple edittext boxes, and thats working just fine. I also have a Spinner in my activity with a string-array for it's usable values. But I am unclear on how to write the spinners selection to the SharedPreferences, then read the SharedPreferences later to retireve and set it's value.</p>

<p>Here is the configuration I have for the edittext's:</p>

<p>-Button to activate save values to SharedPreferences-</p>

<pre><code>public void buttonSaveSendClick(View view) {

    SharedPreferences.Editor editor = getPreferences(0).edit();

    EditText editTextCallId = (EditText) findViewById(R.id.editTextCallId);
    editor.putString("editTextCallIdtext", editTextCallId.getText().toString());
    editor.putInt("selection-startCallId", editTextCallId.getSelectionStart());
    editor.putInt("selection-endCallId", editTextCallId.getSelectionEnd());
    editor.commit();
}
</code></pre>

<p>-Button to activate restore last saved values from SharedPreferences-</p>

<pre><code>public void buttonRestoreLastClick(View view) {

    SharedPreferences prefs = getPreferences(0); 

    EditText editTextCallId = (EditText) findViewById(R.id.editTextCallId);
    String editTextCallIdtextrestored = prefs.getString("editTextCallIdtext", null);
    editTextCallId.setText(editTextCallIdtextrestored, EditText.BufferType.EDITABLE);
    int selectionStartCallId = prefs.getInt("selection-startCallId", -1);
    int selectionEndCallId = prefs.getInt("selection-endCallId", -1);
    editTextCallId.setSelection(selectionStartCallId, selectionEndCallId);
}
</code></pre>

<p>Any suggestions on how to construct the collection of the spinner's selected value in the first button (save)?  Then how to return that saved value to the spinners view on press of the "restore" button?</p>
