Code example for SQLiteDatabase

Methods: closecompileStatement

0
		 
		String sql = "INSERT INTO tip (tip_creator, symbol, target_price, reason) VALUES (?, ?, ?, ?)";
		 
		StockDatabase dbHelper = new StockDatabase(this.getApplicationContext());
		SQLiteDatabase db = dbHelper.openDatabase();
		SQLiteStatement stmt = db.compileStatement(sql);
		stmt.bindString(1, "USERNAME");
		stmt.bindString(2, symbol);
		stmt.bindDouble(3, targetPrice);
		stmt.bindString(4, reason);
		stmt.execute();
		stmt.close();
		 
		db.close();
		 
		tvTipStatus.setText("Tip saved!");
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE