Code example for SQLiteOpenHelper

Methods: closegetWritableDatabase

		return qrcodes;
	public synchronized void insertQRCode(QRCode qrcode) {
		SQLiteDatabase db = mQRCodeDBHelper.getWritableDatabase();
		ContentValues qrcodeValues = new ContentValues();
		qrcodeValues.put(URL, qrcode.getId());
		ByteArrayOutputStream ostream = new ByteArrayOutputStream();
		qrcode.getBitmap().compress(Bitmap.CompressFormat.JPEG, 100, ostream);
		qrcodeValues.put(IMAGE, ostream.toByteArray());
		qrcodeValues.put(DATE, qrcode.getDate().getTime());
		db.insert(QRCODES_TABLE, URL, qrcodeValues);
	public synchronized void removeOldestQRCode() { 
		SQLiteDatabase db = mQRCodeDBHelper.getWritableDatabase();
		Cursor cursor = db.query(QRCODES_TABLE, null, null, null, null, null, DATE + " ASC", "1");
Connect your IDE to all the code out there  Get Codota for Java