Resetting the preferences on first launch of an app

If you want to reset or change preferences of an app at the first start here is an example of code you can put in an event as onCreate of the main activity:

This code saves a version number of preferences if the version is less than a predetermined value (newPrefsVersion).
In this example, the preferences are deleted but you can edit or delete individual entries of the preferences with the methods provided by the class Editor.

Leave a Comment

Your email address will not be published.