How to delete a RAW contact in android 2.x without having the Aggregation contact ID

by Timo Prill » Wed, 21 Apr 2010 23:09:14 GMT


Sponsored Links
 hi

i am fighting against the 2.x contact api...

my problem is, i only have the RAW_CONTACT_ID of a contact.
i want to delete this raw contact programmatically.

i tried the following (even in a row):

            this.cr.delete(ContactsContract.Contacts.CONTENT_URI,
                    ContactsContract.Contacts.Data.RAW_CONTACT_ID + EQUALS
                            + rawContactID, null);

            this.cr.delete(ContactsContract.RawContacts.CONTENT_URI,
                    ContactsContract.RawContacts.CONTACT_ID + EQUALS
                            + rawContactID, null);

            this.cr.delete(ContactsContract.Data.CONTENT_URI,
                    ContactsContract.Data.RAW_CONTACT_ID + EQUALS
                            + rawContactID, null);

after these deletions, i see an empty contact called "(Unknown)" left in 
my Adress book.

this contact can not even be deleted via menu -> delete.

now my question is, how can i delete a contact without having the 
aggregation contact id?

did i miss some table to go through?
is my only chance to set the "deleted" flag for the raw_contact_id?
and: if i never sync with a sync-adapter afterwards, will my "deleted" 
contact remain in the database forever?


scratching my head..
cheers
timo...

--



Other Threads

1. Accessing SharedPreferences

Hello,

I need help with what should be a trivial question.

I created a PreferenceActivity with a couple of preferences on it. I
can change and (apparently) save these preferences with no effort. The
UI looks nice, yadda yadda yadda.

Now, I've reached the point where I need to get to the saved
preference values programmatically, and make actual use of them. In my
application's main activity, I'm calling getSharedPreferences(), but
none of the preferences I've saved in the elegant Preferences UI seem
to exist anywhere.

The Android doc says that access to the SharedPreferences object is
simple through getSharedPreferences(). Okay, fair enough, it's simple.
But it seems to me that If the getSharedPreferences() method takes the
name of a preferences file, I would need to somehow know what name to
specify there so it's reading the same file the preferences screen
wrote.

In review, what I need to do is read the preferences that were saved.
Can someone clue me in on how to do that?

Thanks,
Kelly Schrock

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

2. Lat/Lon Calculation

I need to compute the lat/lon for a point which is located 'n' meters
south and north of a given location. Is there a class to help with
this calculation?

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

3. Button Up? LongClick?

4. $25 fee to list your apps on Googles Marketplace...

5. Had to happen...

6. Testing state change

7. Paging a ListView