title: SharedPreferences disappear when killing app
body: <p>I'm trying to make an app with accounts, but I'm struggling with <code>SharedPrefences</code>. I made them save the account name, and it works, but only when I kill app once, I can turn off the phone and get it back on, and it's still there, but when I kill the app with saved preferences for 3/4 times, all accounts are gone. What is the problem, I save preferences with <code>onPause</code>, <code>onDestroy</code>, <code>onStop</code> and read with <code>onResume</code>, <code>onCreate</code>, onRestart. Before I had only the onPause and onResume and it worked the same. Here is the code :</p>
  
  <pre><code>   @Override
  protected void onPause(){
      super.onPause();
  
      sharedpref = this.getPreferences(Context.MODE_PRIVATE);
      SharedPreferences.Editor editor = sharedpref.edit();
      editor.putString("uzytkownik1", getIntent().getStringExtra("nazwauz"));
      editor.putString("uzytkownik2", getIntent().getStringExtra("nazwauz2"));
      editor.putString("uzytkownik3", getIntent().getStringExtra("nazwauz3"));
      editor.putString("uzytkownik4", getIntent().getStringExtra("nazwauz4"));
      editor.putString("haslo1", getIntent().getStringExtra("haslouzy1"));
      editor.putString("haslo2", getIntent().getStringExtra("haslouzy2"));
      editor.putString("haslo3", getIntent().getStringExtra("haslouzy3"));
      editor.putString("haslo4", getIntent().getStringExtra("haslouzy4"));
      editor.apply();
  }
  </code></pre>
  
  <p>And I wrote the same in onStop and onDestroy.</p>
  
  <p>onResume: </p>
  
  <pre><code>        sharedpref = this.getPreferences(Context.MODE_PRIVATE);
      if (sharedpref.getString("uzytkownik1", null) != null || sharedpref.getString("uzytkownik2", null) != null || sharedpref.getString("uzytkownik3", null) != null || sharedpref.getString("uzytkownik4", null) != null) {
          user1.setText(sharedpref.getString("uzytkownik1", null));
          user2.setText(sharedpref.getString("uzytkownik2", null));
          user3.setText(sharedpref.getString("uzytkownik3", null));
          user4.setText(sharedpref.getString("uzytkownik4", null));
  </code></pre>
  
  <p>and the same in <code>onCreate</code>, and <code>onRestart</code>.</p>