Code example for SQLiteDatabase

Methods: closeisOpenupdate

0
	 
	private boolean update(Context context,  ActionEvent ae, final ContentValues target){
		DatabaseHelper dh = new DatabaseHelper(context, TABLE_NAME);
		SQLiteDatabase db = dh.getWritableDatabase();
  
		if(db.isOpen()){
			db.update(TABLE_NAME, target, KEY_START_TIMESTAMP + "=?", new String[]{Long.toString(ae.getStartTimestamp())});	
			db.close();
			return true; 
		}else{ 
			db.close();
			return false; 
		} 
	}	 
	 
	public ArrayList<ActionEvent> getAllItems(Context context){
		ArrayList<ActionEvent> aeList = new ArrayList<ActionEvent>();
		aeList.addAll(getAllItems(context, false));
		aeList.addAll(getAllItems(context, true));
		return aeList;
	}