How do I update an android sqlite database column value to null using ContentValues?
AndroidSqlDatabaseSqliteAndroid Problem Overview
For example, I want to do the following on a database update.
Is there a constant I can use instead of null
, which won't compile if I use it like:
ContentValues args = new ContentValues();
args.put(KEY_RISK_AMOUNT, null); // what constant do I use instead of null?
Android Solutions
Solution 1 - Android
Use ContentValues.putNull(java.lang.String)
:
ContentValues args = new ContentValues();
args.putNull(KEY_RISK_AMOUNT);