Search in sources :

Example 1 with DBHelper

use of nodomain.freeyourgadget.gadgetbridge.database.DBHelper in project Gadgetbridge by Freeyourgadget.

the class GBApplication method deleteOldActivityDatabase.

/**
     * Deletes the legacy (pre 0.12) Activity database
     *
     * @return true on successful deletion
     */
public static synchronized boolean deleteOldActivityDatabase(Context context) {
    DBHelper dbHelper = new DBHelper(context);
    boolean result = true;
    if (dbHelper.existsDB("ActivityDatabase")) {
        result = getContext().deleteDatabase("ActivityDatabase");
    }
    return result;
}
Also used : DBHelper(nodomain.freeyourgadget.gadgetbridge.database.DBHelper)

Example 2 with DBHelper

use of nodomain.freeyourgadget.gadgetbridge.database.DBHelper in project Gadgetbridge by Freeyourgadget.

the class DbManagementActivity method exportDB.

private void exportDB() {
    try (DBHandler dbHandler = GBApplication.acquireDB()) {
        DBHelper helper = new DBHelper(this);
        File dir = FileUtils.getExternalFilesDir();
        File destFile = helper.exportDB(dbHandler, dir);
        GB.toast(this, getString(R.string.dbmanagementactivity_exported_to, destFile.getAbsolutePath()), Toast.LENGTH_LONG, GB.INFO);
    } catch (Exception ex) {
        GB.toast(this, getString(R.string.dbmanagementactivity_error_exporting_db, ex.getMessage()), Toast.LENGTH_LONG, GB.ERROR, ex);
    }
}
Also used : DBHandler(nodomain.freeyourgadget.gadgetbridge.database.DBHandler) DBHelper(nodomain.freeyourgadget.gadgetbridge.database.DBHelper) File(java.io.File)

Aggregations

DBHelper (nodomain.freeyourgadget.gadgetbridge.database.DBHelper)2 File (java.io.File)1 DBHandler (nodomain.freeyourgadget.gadgetbridge.database.DBHandler)1