1

I am re-using ListPreference for a setting which I store only in the database. How can I prevent it from storing/persisting any data to the preference file?

XåpplI'-I0llwlg'I -
  • 21,649
  • 28
  • 102
  • 151
Pentium10
  • 204,586
  • 122
  • 423
  • 502

2 Answers2

3

Subclass it, override shouldPersist() to return false.

yanchenko
  • 56,576
  • 33
  • 147
  • 165
  • 1
    This will work, but the proper way is to simply call `setPersistent(false)`. Documentation for this method is [here](http://developer.android.com/reference/android/preference/Preference.html#setPersistent(boolean)). – XåpplI'-I0llwlg'I - Jan 04 '13 at 17:42
0

I've not done it myself, but have you looked into overriding onDialogClosed()?

Mark B
  • 183,023
  • 24
  • 297
  • 295