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

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):

                    ContactsContract.Contacts.Data.RAW_CONTACT_ID + EQUALS
                            + rawContactID, null);

                    ContactsContract.RawContacts.CONTACT_ID + EQUALS
                            + rawContactID, null);

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


Other Threads

1. ImageView alpha fade to transparent vs. fade to black

Greetings! I have searched this group, read the Common Tasks FAQ,
searched elsewhere, to no avail. Here's what I've got working so far.
Pardon the obvious lack of refactoring. Right now I'm in the "make it
work" phase of things (vs. "make it right" and "make it fast" <grin>):

For starters, we have a basic, tire-kicking type of Android 2.0 app.

Main layout (XML) is a simple LinearLayout with two views, an
ImageView and a WebView. Both use fill_parent for width + height.
ImageView appears on top of WebView, z-order wise. (Done/working.)

An anim(ation) resource for fadeout has also been created, using
accelerate_decelerate_interpolator. All it does is run the alpha down
from 1.0 to 0.0, using config_longAnimTime. (Done/working.)

A given Activity (that also implements AnimationListener) is
initialized with the aforementioned main layout. Thus, once this
particular Activity kicks in, you start off by seeing just the
ImageView. Meanwhile, the WebView is asked to load a particular URI.
When onPageFinished is called, we see if the ImageView is visible.

If ImageView is visible, we create an Animation object, loading our
trusty fadeout via loadAnimation. We set up an animation listener
(keep reading) and kick off the fadeout on our ImageView. (Done/

Once onAnimationEnd is called (remember, we 'set up us the listener')
we set the ImageView's visibility to View.GONE. (Yes, we should very
likely remove the view entirely since we never need it again, but bear
with me - I'm starting off with "make it work" - still finding our way
around town in this regard!) (Done/working.)

Here's the part that is NOT working - or at least it's not working as
expected/desired. The animation is fading the ImageView, but it's
fading to black instead of fading to transparent. We want to fade in
such a way that we reveal the WebView lurking beneath it - our
"desired effect" if you will.

What's happening now is, you see the image fade to black, then the
view is hidden (View.GONE), thus at that point the now-black display
disappears, and POP - there's our web view.

Ah-ha, you (might?) say, use a transparent background color! Then it
fades to transparent and you're all set. Sure enough, that's what I
tried next, adjusting the ImageView's XML to use a background color of
transparent (@android:color/transparent IIRC) and it STILL fades to
black. Thus, I suspect I'm doing something blatantly wrong but can't
put my finger on why.

Clues welcome/appreciated. Thank you!

- JD


2. Must I restart the emulator on code changes?

I'm using Eclipse as my IDE and I can start the emulator and test code
without issue (although it takes FOREVER to start up). I've read that
I should keep the emulator running and retest code changes but, when I
try, I get the following error:

Emulator]emulator: ERROR: the user data image is used by another
emulator. aborting

Any thoughts?


3. How to develop Arabic to English Dictionary in Android

4. Issue Launching Emulator from Command Line

5. stream internet radio

6. Trouble installing from SDK and AVD Manager: access denied unzipping

7. SDK : how can I get result from the dialer ?