title: Shared Preferences Data resets when application is closed
body: <p>In my app am storing the score its an integer by using shared preference.<br>
  Its stores the score whenever the score gets higher than previous one. (If the score is lower than the previous one it wont store.) 
  But when I completely close the app (i.e) closed from task manager and  again restarted the score is reset by new score even though my current score is lower than previous one.</p>
  
  <p>Here the code:</p>
  
  <pre><code>SharedPreferences pref = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
  if (mScr &gt; tempScore) {
      Editor editor = pref.edit();
      editor.putInt("key_name", mScr);
      editor.commit();
  }
  tempScore = pref.getInt("key_name", 0);
  </code></pre>
  
  <p>Can any one say how to over come this?</p>