title: How to delete saved data in Shared Preferences in android?
body: <p>I am using facebook api in my app. Its working fine i can login and post on wall. But i couldn't delete the login information.</p>
  
  <p>This is the code </p>
  
  <pre><code>   public boolean saveCredentials(Facebook facebook) {
          Editor editor = getApplicationContext().getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
          editor.putString(TOKEN, facebook.getAccessToken());
          editor.putLong(EXPIRES, facebook.getAccessExpires());
          return editor.commit();
      }
  
      public boolean restoreCredentials(Facebook facebook) {
          SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(KEY, Context.MODE_PRIVATE);
          facebook.setAccessToken(sharedPreferences.getString(TOKEN, null));
          facebook.setAccessExpires(sharedPreferences.getLong(EXPIRES, 0));
          return facebook.isSessionValid();
      }
  
      public boolean removeCredentials()
      {
          SharedPreferences prefs = getApplicationContext().getSharedPreferences(KEY, Context.MODE_PRIVATE);
  
              facebook.setAccessToken(prefs.getString("", null));
          facebook.setAccessExpires(prefs.getLong("", 0));
          Editor editor = prefs.edit(); 
          editor.clear();
          editor.commit(); 
          return true; 
      }
  </code></pre>
  
  <p>The Shared preferences details hasn't deleted by calling <code>removeCredentials()</code> method. It just post the message on facebook wall. </p>
  
  <p>I just want to delete the saved details and if again user requests to posting the message on wall then i need to popup the login screen.</p>
  
  <p>Thanks for your Help guys</p>