0

Out of a "settings activity" I would like to delete the (default) Preferences, accessed only in another activity by getPreferences(MODE_PRIVATE). I would like the current activity to resume as normal. Is this any possible in android?

Easiest I could think of is making the Preferences Shared, which is completely unnecessary otherwise however. Would that be a big drawback (security-wise)? Or is there a better solution?

borartr
  • 63
  • 1
  • 6
  • It is pretty unclear what you asked. – blackapps Jun 11 '20 at 07:50
  • Well, it's the same question as https://stackoverflow.com/q/3687315/6123162 but for Preferences instead of SharedPreferences. I want to just delete all of them, even out of other activcity, without killing the whole app. Right now i edited my code to contain only SharedPreferences (as they can be accessed from anywhere), but I think thats 'hacky' – borartr Jun 11 '20 at 09:57
  • 1
    Leave the Preferences where they are. In that activity. You can reach them from any other activity using getSharedPreferences( "activityname", mode). – blackapps Jun 11 '20 at 11:15
  • 1
    `Easiest I could think of is making the Preferences Shared, `. They are shared. You should only use the activity name if you need them in a different activity. – blackapps Jun 11 '20 at 11:18
  • I think I begin to understand you, so `getPreferences(mode)` = `getSharedPreferences(this_activity_name, mode)` ? I did not know that before. I thought the difference to be like private vs. public. – borartr Jun 11 '20 at 11:52

0 Answers0