title: Can we delete SharedPreferences when closing the app
body: <p>I searched in google. i can find an answer for clearing the shared preference but i need to clear the shared preferences when app getting closed. is this possible pls help.</p>
  
  <p>code clear shared preference</p>
  
  <pre><code> public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  SharedPreferences preferences = 
  PreferenceManager.getDefaultSharedPreferences(this);
  SharedPreferences.Editor editor = preferences.edit();
  editor.putString("UserName", "Tonny");
  editor.putInt("UserAge", 20);
  editor.commit();
  </code></pre>