title: SharedPreference not updated after commit()
body: <p>I know this question already have tons of answer in SO but I haven't found the answer to my problem.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(Config.SHARED_PREF_NAME, Context.MODE_PRIVATE);
  
  //Creating editor to store values to shared preferences
  SharedPreferences.Editor editor = sharedPreferences.edit();
  editor.clear();
  
  //Adding values to editor
  editor.putBoolean(Config.LOGGEDIN_SHARED_PREF, true);
  editor.putString(Config.PHONE_SHARED_PREF, phoneNo);
  Log.d("debug", "config "+Config.PHONE_SHARED_PREF);
  Log.d("debug", "config "+phoneNo);
  
  //Saving values to editor
  editor.apply();
  editor.commit();
  </code></pre>
  
  <p>What I understand is, <code>editor.putString(Config.PHONE_SHARED_PREF, phoneNo)</code> means save the value of <code>phoneNo</code> into <code>PHONE_SHARED_PREF</code>. Please correct me if I'm wrong.</p>
  
  <p>But when in Log, <code>Config.PHONE_SHARED_PREF</code> printed the default value, instead of the new value assigned in <code>phoneNo</code>. That's mean the value of <code>phoneNo</code> not correctly saved, no?</p>
  
  <p>Can someone explain to me what's wrong with my code? :/</p>