Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How i delete selected person to ContactList in application (Titanium- Android)?

I use getAllPerson() function and show all people in TableView i want to do delete selected person. but removePerson() only supported for iphone, how i delete with Android. any suggestion appreciated

like image 761
MRT Avatar asked May 28 '12 10:05

MRT


1 Answers

I don't know how you implemented the edit action that should remove the selected person, but, I think that, as the removePerson is not yet implemented (may be never) for Android, you have to use intents.

For this, here are two sources where you can find all the information you have to know:

  • The Appcelerator's intent CookBook information.
  • This source used in the presentation above.

On by clicking on the person you want to delete, you have to get his contact ID.

Then, here is where I'm not sure at all :

intent: (function() {
    var contactId = '1'; // Your contact ID !!!
    if (contacts[0]) {
        contactId = parseInt(contacts[0].id) + '';
    }
    var contactUrl = 'content://com.android.contacts/raw_contacts/' + contactId;
    var intent = Ti.Android.createIntent({
        action: Ti.Android.ACTION_DELETE,
        data: contactUrl
    });
    return intent;
})()
like image 138
Zakaria Avatar answered Nov 04 '22 00:11

Zakaria