I have an app on the Google Play market. For various reasons that I won\'t bother going into, I have changed the type of some of my preferences. For example a preference t
final String PREFERENCE_NAME = "my_preference";
final String APP_VERSION_CODE = 6; /*change this each time you want to clear
preference in updated app.*/
preferences = getSharedPreferences(PREFERENCE_NAME, MODE_PRIVATE);
if (preferences.getInt(PREFERENCE_VERSION, 0) != APP_VERSION_CODE) {
preferences.edit().clear().apply();
preferences.edit().putInt(PREFERENCE_VERSION, APP_VERSION_CODE).apply();
}