When are SharedPreferences deleted?

后端 未结 3 1016
借酒劲吻你
借酒劲吻你 2021-01-11 18:06

SharedPreferences class allows to save application data in simple type (boolean, String, etc.) formats.

Normally they are not removed and they are supposed to persi

相关标签:
3条回答
  • 2021-01-11 18:09
    1. Sharedpreferences will clear when you clear application data from Application manager by force.

    2. If you want to clear your application Sharepreference data, then you can use:

      PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();
      
    0 讨论(0)
  • 2021-01-11 18:12

    Go to Setting->Application setting->Application->Clear data and force data will clear all the data of application (sqlitedatabase and shared preferences) are removed.

    0 讨论(0)
  • 2021-01-11 18:14

    when you do clear data from the device applications manager or when you uninstall your application, the SharedPreference's file is deleted.

    SharePreferences are stored inside

    /data/data/packagename/shared_prefs/prefsname.xml
    

    unless you have the android:allowBackup="true" in your manifest. In that case they might be restored.

    0 讨论(0)
提交回复
热议问题