vendredi 30 janvier 2015

How to restore database from backup agent saved path android

I am using this code for saving database, using BackupAgent class



public class MyBackupAgent extends BackupAgentHelper {

String DATABASE_NAME = "mydb";
String DATABASE_FILE_NAME = "mydb.db";
@Override
public void onCreate() {
SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
addHelper(PREFS_BACKUP_KEY, helper);

FileBackupHelper dbs = new FileBackupHelper(this, DATABASE_FILE_NAME);
addHelper("dbs", dbs);
}

@Override
public File getFilesDir() {
File path = getDatabasePath(DATABASE_FILE_NAME);
return path.getParentFile();
}


}


Now after that i want to know how to restore database? Please help me about this, Thanks in advance


Aucun commentaire:

Enregistrer un commentaire