Task Manager's Force Close Delete my app's preferences but why?
<p>Im building my first android game, my problem is:</p>

<p>When I exit from the app with my phone's "back\exit" button, my app is closing and all the information I need is nicely saved to a preference file:</p>

<pre><code> @Override
 protected void onPause() 
 {

 super.onPause();

 // My pref file
 SharedPreferences preferences = getSharedPreferences(PREF_FILE_NAME, 0);
 SharedPreferences.Editor editor = preferences.edit();

 // Put the values to the pref file
 editor.putInt("CsereHolTart", CsereHolTart);
 editor.putInt("melyikAct", melyikAct);
 editor.putInt("Silver", Silver);
 editor.putInt("Strength", Strength);
 editor.putInt("Intelligence", Intelligence);
 editor.putInt("Dexterity", Dexterity);
 editor.putInt("Speed", Speed);
 editor.putInt("Vitality", Vitality);
 editor.putInt("Morale", Morale);
 editor.putInt("cHp", cHp);
 editor.putInt("cMp", cMp);

 editor.putInt("isGame", 1);



 // Commit to storage
 editor.commit();


  }
</code></pre>

<p>See? I simply use the onPause() method to put all the things I need to a preference file actually to this:</p>

<pre><code>public static final String PREF_FILE_NAME = "PrefFile";
</code></pre>

<p>When I open the app, all the saved data is well read, and my app continues from the right pont with the valid values I saved then loaded.</p>

<p>THIS IS GOOD, BUT:</p>

<p>When I close my applicaton with my phone's task manager, so i manually do a "force close", it seems onPause() is just not running, or something else I dont know. So the matter is when I close my app with task manager, all the loadings are fails, it seems all the saved data is deleted. Becuse every preference is loaded to default in that way.</p>

<p>Can anybody tell me what should I do to solve this task manager's force close problem?
I want to save and load everytime the user exit from the app or opens the app.</p>
