How can I migrate Android preferences with a new version?
<p>I have an app where I'm storing user preferences like this:</p>

<pre><code>public static final String KEY_PREFS_LOGIN_INFO = "login_info";
public static final String KEY_PREFS_FILE_VERSIONs = "file_versions";
public static final String KEY_PREFS_LOGS = "logs";
public static final String KEY_PREFS_OTHERS = "others";
</code></pre>

<p>With pref-specific methods like this:</p>

<pre><code>public static void setFileVersion(String key) {
    SharedPreferences settings = getAppContext().getSharedPreferences(KEY_PREFS_FILE_VERSIONS, 0);
    SharedPreferences.Editor editor = settings.edit();
    editor.putString("current", key);
    editor.commit();
}
</code></pre>

<p>and then retrieving the values like this:</p>

<pre><code>public static String filesVersion() {
    SharedPreferences settings = getAppContext().getSharedPreferences(KEY_PREFS_FILE_VERSIONS, 0);
    String current = settings.getString("current", "");
    return current;
}
</code></pre>

<p>What I want to do is have all of my preferences be stored in one location, so I can use a generic method to access any of them. How can I set a way to, on upgrade, migrate values from the old storage locations to the new? I'm looking for something similar to the onUpgrade() method in a SQLiteOpenHelper.</p>
