Code example for SQLiteOpenHelper

Methods: close

0
        helper = new DBOpenHelper(context);
    } 
 
    public void close() { 
        if (helper != null)
            helper.close();
    } 
 
    public void open() { 
        if(helper == null)
            helper = new DBOpenHelper(context);
    } 
 
    public Cursor query(String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        qb.setTables(getTableName());
        SQLiteDatabase db = helper.getReadableDatabase();
        Cursor cursor = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
 
        return cursor;
Stop searching for code, let great code find you!  Add Codota to your java IDE