title: android default values for shared preferences
body: <p>I am trying to understand the SharedPreferences of Android. I am a beginner
  and don't know a lot about it.</p>
  
  <p>I have this class I implemented for my app Preferences</p>
  
  <pre><code>public class Preferences {
      public static final String MY_PREF = "MyPreferences";
  
      private SharedPreferences sharedPreferences;
      private Editor editor;
  
      public Preferences(Context context) {
          this.sharedPreferences = context.getSharedPreferences(MY_PREF, 0);
          this.editor = this.sharedPreferences.edit();
      }
  
      public void set(String key, String value) {
          this.editor.putString(key, value);
          this.editor.commit();
      }
  
      public String get(String key) {
          return this.sharedPreferences.getString(key, null);
      }
  
      public void clear(String key) {
          this.editor.remove(key);
          this.editor.commit();
      }
  
      public void clear() {
          this.editor.clear();
          this.editor.commit();
      }
  }
  </code></pre>
  
  <p>The thing is that I would like to set default preferences. They would be set when the app is installed and could be modified after by the application and stay persistent.
  I heard about a preferences.xml but I don't understand the process.</p>
  
  <p>Could someone help me?</p>
  
  <p>Thanks for you time</p>