Update all the contacts belonging to one group

by cyril.at...@gmail.com » Mon, 28 Sep 2009 19:58:51 GMT

Sponsored Links
 Dear all,

I have an application that updates all the contacts belonging to a
group, I currently do the following :
-> Get the group id
-> Get all the contacts id inside this group
-> For each of them I am doing an update on the contact => This is
really heavy and seems to take time in real phones while I expect it
to be "instantaneous".

I am wondering if we can, in the ContentResolver.update() method
specify a kind of join.
For instance I'd like to do something like :
UPDATE <people> SET <people.name>="<new name>" FROM People p,
GroupsMemberships gm WHERE p.person_id=gm.person_id and

Does anyone know if it's possible or not?

The update method has got a "where" attribut but can we use this
attribut for complexe requests ?
where   A filter to apply to rows before deleting, formatted as an SQL
WHERE clause (excluding the WHERE itself).

Thanks to everyone for its feedback.

Update all the contacts belonging to one group

by Mark Murphy » Mon, 28 Sep 2009 20:20:36 GMT


Not that I am aware of. Bear in mind that not all content providers will
be using a SQL database as the place of data storage.

Since the contacts content provider does appear to use SQLite, rather
than iterating over your contacts, though, you could try the IN syntax
in the WHERE-style constraint:

[WHERE] person_id IN (...)

where ... is a comma-delimited set of values, or possibly even a
sub-select to get the IDs of the contacts to update.


Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Looking for Android opportunities?  http://wiki.andmob.org/hado 


Sponsored Links

Update all the contacts belonging to one group

by 6real » Wed, 30 Sep 2009 04:02:50 GMT

 Dear Mark,

your solution sounds really great but I discovered that it is just ...
impossible to make some bulk operation on contacts (at least until
release r3).

I then optimized my code to update just what has to be updated.

Thanks you by the way for your answer.



Other Threads

1. "There is a problem communicating with Google servers"

I just got the Dev. phone today and trying to get it "up and
running'.   I am trying to create a google account but I keep getting
an error message

"There is a problem communicating with Google servers

This could be a temporary problem or your SIM card may not be
provisioned for data services.  if it continues, call Customer Care."

First, I know that my SIM has a data plan.  After all, I have been
using text messages, navigation...etc with it.  So, I don't think it
is the SIM problem.

It could be a "temporary problem".  But, what is "a temporary
problem" ?  I have been trying a few times within the last hour and
still getting the same error messages.

It said, "if it continues, call Customer Care.".  I don't know if this
helps because my carrier would just say, yes I have data plan
provision with the SIM card.

Does anyone have any suggestion to what went wrong ?  Any feedback is
greatly appreciated.

Thank you.


2. Bitmap from webview

I would like to get a bitmap of a webview control that I can then clip
and manipulate.  How do I use the getpicture method or another means
to do this?



3. Several questions about drivers and build options

4. loading html file from SDCARD in web browser

5. Request regarding release

6. Android HAL: new drivers

7. License text to use for display in Android App under ASL 2.0