title: Shared Preferences overwrite last value on every key before commit() or Apply()
body: <p>I'm trying to save two Boolean value over two different keys but every-time when i save value in the key it overwrites key with last value only.</p>
  
  <p>Below is the function call to save the value</p>
  
  <pre><code>AssignRegistrationFun manage =
      new AssignRegistrationFun(getApplicationContext());
  manage.ChangeDataState(false,true);
  </code></pre>
  
  <p>Below is the function call in if condition to check the data state...
  at this function call it returns true even though i set the first value to false    </p>
  
  <pre><code>if(manage.checkDataChanged("External")) 
  </code></pre>
  
  <p>below is function definition with class details</p>
  
  <pre><code>import android.content.Context;
  import android.content.SharedPreferences;
  import android.content.SharedPreferences.Editor;
  
  public class AssignRegistrationFun {
      SharedPreferences pref;
      Editor  editor;
      Context _context;
      int PRIVATE_MODE = 0;
      private static final String PREF_NAME ="Tester";
      private static final String EXTERNAL_DATA = "true";
      private static final String INTERNAL_DATA = "true";
  
      public AssignRegistrationFun(Context context){
          this._context = context;
          pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
          editor = pref.edit();
      }
  
      public void ChangeDataState(boolean EX_state,boolean IN_state){
          editor.putBoolean(EXTERNAL_DATA,EX_state);
          editor.putBoolean(INTERNAL_DATA,IN_state);
          editor.commit();//even editor.apply() not works     
      }
  
      public boolean checkDataChanged(String type){
          if(type.equals("External")) 
              return pref.getBoolean(EXTERNAL_DATA,false);
          else
              return pref.getBoolean(INTERNAL_DATA,false);
      }
  
  } 
  </code></pre>
  
  <p>please help me out thanks in advance...      </p>