Shared Preferences aren't setting up
<p>I am using following code in the start of my activity</p>

<pre><code> ArrayAdapter&lt;String&gt; spinnerArrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, transferToOrFromArray);
         spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
         transferTo.setAdapter(spinnerArrayAdapter);
         transferFrom.setAdapter(spinnerArrayAdapter);

         SharedPreferences CNPASettings = getSharedPreferences("CNPA",0);
         transferTo.setSelection(spinnerArrayAdapter.getPosition(CNPASettings.getString("transferTo",spinnerArrayAdapter.getItem(0))));
         transferFrom.setSelection(spinnerArrayAdapter.getPosition(CNPASettings.getString("transferFrom",spinnerArrayAdapter.getItem(0))));
</code></pre>

<p>When i complete doing stuff, i press Done button which contain following code.</p>

<pre><code>                        title = "Success";
                        error = "Transfer has been done";
                        SharedPreferences CNPASettings = getSharedPreferences("CNPA",0);
                        SharedPreferences.Editor prefEditor = CNPASettings.edit();  
                        prefEditor.putString("tranferFrom", transferFrom.getSelectedItem().toString());  
                        prefEditor.putString("tranferTo", transferTo.getSelectedItem().toString());  
                        prefEditor.commit();  
finish();
</code></pre>

<p>But whenver i create the activity again, it passes default values <code>spinnerArrayAdapter.getItem(0))</code></p>

<p>What am i doing wrong?</p>
