You are deleting data associated with the contact, not the contact itself.
 It should be something like this:

ArrayList<ContentProviderOperation> ops = new
ArrayList<ContentProviderOperation>();

ops.add(ContentProviderOperation.newDelete(Contacts.CONTENT_URI)
                         .withSelection(Contacts._ID + "=?", new
String[]{"1"})
                         .build());

On Fri, Jan 29, 2010 at 8:17 AM, andev <aniakarp...@gmail.com> wrote:

> Hello,
>
> I have been working with contacts. I am able to show them, update but
> when I want to delete any, it is not deleted completely. In Contacts
> application is shown as (Unknown) without any data. What is more, I am
> not able to delete it (only after I give this contact name). I have
> tried to change "deleted" flag in RawContacts but it doesn't help -
> contact is still displayed. Here is my example:
>
> ArrayList<ContentProviderOperation> ops = new
> ArrayList<ContentProviderOperation>();
>
> ops.add(ContentProviderOperation.newDelete(Data.CONTENT_URI)
>                          .withSelection(Data.CONTACT_ID + "=?", new
> String[]{"1"})
>                           .build());
>
> getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
>
> Should I do anything else to delete contact entirely?
>
> Thanks,
> Anna
>
>
> On Dec 23 2009, 2:58 am, Dmitri Plotnikov <dplotni...@google.com>
> wrote:
> > Hi Richa,
> >
> > You can find explanations and an example here:
> http://developer.android.com/reference/android/provider/ContactsContr...
> >
> > Cheers,
> > - Dmitri
> >
> > On Tue, Dec 22, 2009 at 3:58 AM, Richa Saraswat <richa....@gmail.com>
> wrote:
> > > as m new to android i just want to know how to get a photo from
> > > person's contact??
> > > hope to get some help...
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> <android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to