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
gm.group_id=<my_group_id>

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.

 http://sqlite.org/lang_expr.html 

-- 
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.

C.





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. release keys do not work

I've had a problem for the last week that the release keys I derive
using keytool or the Export .apk do not function. The map pages show
up blank. When I reinsert my debug key instead, everything works
fine.

For example I have a MD5 fingerprint

Keystore type: JKS
Keystore provider: SUN
Your keystore contains 3 entries
alias77, Dec 1, 2010, PrivateKeyEntry,
Certificate fingerprint (MD5):
AC:F5:3B:F5:E4:01:CA:B0:A5:D0:67:91:16:CE:05:3C
alias7, Nov 30, 2010, PrivateKeyEntry,
Certificate fingerprint (MD5): 98:E4:24:BB:
03:84:A9:76:67:B3:0D:B7:16:89:AB:85
alias00, Dec 2, 2010, PrivateKeyEntry,
Certificate fingerprint (MD5): C7:19:8F:5E:A5:59:E7:5A:DC:B0:ED:EA:BF:
57:5F:EB

Using the last of the above, alias00 above as input, Google offered
this release key:
0VhiLw2B2QaNSmcZKtY-R5Qf40AL9adtEmlpbnw

Everything seems normal but this key does not work. Just inserting it
where my debug key was before, causes the maps to come up blank.

I don't understand how this could happen.

Because of this key problem, I have had to unpublish my five apps as
arecent download customer complained that the maps failed to work for
them either.

Now it seems to me that because I never had an uninstall or complaint
from any other customer before, that all my apps must have been
working OK till just a few days ago.

I made no code changes yet my published apps ceased to work. I believe
this unusual problem is not my fault but rather due to a flaw in the
way the release key is generated or recognized by Google.

This is a major problem for me and I need some assistance ASAP.

- Ian in Nova Scotia


-- 

2. tootip on a image when it gets focussed

hi

how to get tooltip of the image when it gets focussed . we used images
for all the functions that needed to perform like logout, moving to
home page , back page . but we didnt get how to place a tooltip that
helps the user to know about the images can anyone tell us how to
place them

-- 

3. friend locator

4. widgets

5. Can't see quickly incrementing integer until incrementing stops.

6. Upload picture to php server

7. Keeping IntentService alive even if app is killed