Example usage for android.content Context deleteDatabase

List of usage examples for android.content Context deleteDatabase

Introduction

In this page you can find the example usage for android.content Context deleteDatabase.

Prototype

public abstract boolean deleteDatabase(String name);

Source Link

Document

Delete an existing private SQLiteDatabase associated with this Context's application package.

Usage

From source file:Main.java

public static void deleteDataHelper(Context context) {
    context.deleteDatabase(DATABASE_NAME);
}

From source file:Main.java

/**
 * Elimina la base de datos/*  w w w . jav  a2 s . c om*/
 * 
 * @param v
 *            Vista actual
 */
public static void EliminarBasedeDatos(Context c) {
    c.deleteDatabase(DATABASE_NAME);
}

From source file:Main.java

public static void clearDatabaseByName(Context context, String dbName) {
    context.deleteDatabase(dbName);
}

From source file:Main.java

public static void cleanDatabaseByName(Context context, String dbName) {
    context.deleteDatabase(dbName);
}

From source file:Main.java

public static boolean cleanInternalDbByName(Context context, String dbName) {
    return context.deleteDatabase(dbName);
}

From source file:Main.java

public static void deleteDatabase(Context context, String name) {
    String dbName = formatDatabaseName(context, name);
    if (!context.deleteDatabase(dbName)) {
        context.deleteDatabase(dbName.replace(":", "_"));
    }/*from w w w.j a  v  a  2  s . co m*/
}

From source file:Main.java

/**
 * clean databases by name//from   w  w  w.  ja v  a  2s.c o  m
 *
 * @param context
 * @param dbName
 */
public static void cleanDatabases(Context context, String dbName) {
    context.deleteDatabase(dbName);
}

From source file:Main.java

public static void deleteAppDatabases(Context context) {
    String[] dbs = context.databaseList();
    if (dbs == null || dbs.length == 0)
        return;//www.  j  a  v  a 2s .  com
    for (String db : dbs) {
        context.deleteDatabase(db);
    }
}

From source file:com.velli.passwordmanager.ActivityLockScreen.java

public static void maxRetrycountExceeded(Context c) {
    final SharedPreferences prefs = c.getSharedPreferences("password", Context.MODE_PRIVATE);
    final int maxRetryCount = PreferenceManager.getDefaultSharedPreferences(c)
            .getInt(c.getString(R.string.preference_key_max_retry_count), 15);

    PasswordDatabaseHandler.getInstance().closeDatabase();
    c.deleteDatabase(Constants.DATABASE_NAME);
    prefs.edit().putInt("retrys left", maxRetryCount).apply();

    Toast.makeText(c, "All passwords deleted!", Toast.LENGTH_LONG).show();
    if (c instanceof AppCompatActivity) {
        ((AppCompatActivity) c).finish();
    }//from ww w  . j a  va 2  s. co  m
}

From source file:org.wso2.iot.agent.utils.CommonUtils.java

/**
 * Clear application data./*from   w ww  .j a  va2s .c o m*/
 * @param context - Application context.
 */
public static void clearAppData(Context context) throws AndroidAgentException {
    try {
        revokePolicy(context);
    } catch (SecurityException e) {
        throw new AndroidAgentException("Error occurred while revoking policy", e);
    } finally {
        Preference.clearPreferences(context);
        context.deleteDatabase(Constants.EMM_DB);
    }
    Toast.makeText(context, R.string.toast_message_disenroll, Toast.LENGTH_LONG).show();
}