54

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?
3
  • 21
    I found the answer...I need to do this: args.putNull(KEY_RISK_AMOUNT) Commented Jun 4, 2011 at 1:48
  • 2
    You should answer your own question and come back tomorrow to mark it as the accepted answer if it works as intended. Commented Jun 4, 2011 at 2:05
  • I don't think I can answer my own question, at least I don't see how... Commented Jun 4, 2011 at 17:41

1 Answer 1

98

Use ContentValues.putNull(java.lang.String):

ContentValues args = new ContentValues();
args.putNull(KEY_RISK_AMOUNT);
Sign up to request clarification or add additional context in comments.

3 Comments

bonus points for answering this question when the o.p. already answered himself in the comments 20 days before your answer and then getting 10 upvotes! Nicely done :)
Well, someone had to do it. :p
good answer... putNull easy to understand this method on content values class :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.