Code example for SharedPreferencesBackupHelper

0
    static final String PREFS_BACKUP_KEY = "prefs";
 
    // Allocate a helper and add it to the backup agent 
    @Override 
    public void onCreate() { 
        SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this,
                this.getPackageName() + "_preferences");
        addHelper(PREFS_BACKUP_KEY, helper);
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java