Code example for SQLiteDatabase

Methods: beginTransactionendTransactionsetTransactionSuccessfulupdate

0
	public long _id = -1;
 
	public synchronized boolean update(final Context context,
			final SQLiteDatabase db) {
		int result = 0;
		db.beginTransaction();
 
		try { 
 
			if (_id > 0) {
				result += db.update(getTableName(), getContent(), whereIdIs,
						whereIdArg()); 
			} 
 
			if (result > 0) {
				db.setTransactionSuccessful();
			} 
 
		} 
		catch (SQLException e) {
			throw e;
		} 
		finally { 
			db.endTransaction();
		} 
 
		if (result > 0) {
			notifyProviderOnChange(context);
		}