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. Soft touch buttons (virtual buttons) usablilty

Most phones now have soft touch buttons (including the new Nexus S).

I really struggle with soft touch buttons.  They are too close to the
screen for me.  And for some reason, on my N1, I have to press them
right at the top for them to register, so I'm often pressing controls
on the screen rather then the buttons.

I've noticed a few complaints about this.  However, I would be
interested to know if some phones work better then others with the
soft touch buttons.

Has anyone tried a few phones with soft touch buttons and noticed a


2. Typical App Registration in Android - Code Sample

  I am new to Phone app programming.  I am starting with Android.
What is typical registration page for a typical app.  I am thinking
  1.  Phone Unique Id
  2.  Phone number
  3.  User name

When a user downloads my app I need to collect all of the above and
call a web service to save this info.
This info will be used to provide other services.

Can I get some codes sample and/or pointers.

Thanks in advance,


3. CONTACT_ID - Keeping it in sync

4. Nexus S gingerbeard from samsung

5. How to differentiate a tap event generated by system or by user

6. Layanan wimax 4g

7. (WTS) HTC desire garansi 2nd htc indonesia