Thursday, June 2, 2011

Re: [android-developers]Why insert row into table return null?

Some comments:
  1. You use getContentResolver().insert(uri,values) to insert a row into a content provider. Please don't equate content provider = database. Though many content providers are implemented as databases, it's not a requirement. In particular, a database provides operations such as "join" that a content provider is not required to implement.
  2. A null result from a content provider method usually indicates an error.
    In particular, the common pattern for "query" is to return null if an internal error occurred (for example, an invalid URI). If no records match the query, the common pattern is to return a Cursor with no records.
  3. Since you're getting null for "insert", the first thing I'd check is the URI value you're passing in.
A. Elk

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment