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 Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.