How to send all calls to voicemail except whitelist contacts in Android -


i trying develop app need send calls automatically voicemail except few whitelist contacts ids storing in different table of app. can 1 suggest me right approach of doing this.

here code wore, can select contacts in list in order direct calls contacts directly mailbox, or not mailbox.

stringbuilder mailboxids = new stringbuilder(""); // stringbuilder collects id of checked contacts in list     int visibleitemcount = contactadapter.getcount();      (int = 0; < visibleitemcount; i++) { // iterating visible , checked contacts of list         contactitem contactitem = contactadapter.getitem(i);         if (contactitem.ischecked()) {             mailboxids.append(contactitem.getid() + ","); // creating coma-seperated string ideas later query         }     }      mailboxids.replace(mailboxids.length() - 1, mailboxids.length(), ""); // removing last coma list     contentresolver contentresolver = getactivity().getcontentresolver();     contentvalues contentvalues = new contentvalues();     contentvalues = new contentvalues();     if(tomailbox){ // if selected contacts should go mailbox         contentvalues.put(contacts.send_to_voicemail, 1);     }else{ // if selected contacts should not go mailbox         contentvalues.put(contacts.send_to_voicemail, 0);     }     contentresolver.update(contacts.content_uri, contentvalues, basecolumns._id + " in (" + mailboxids + ")", null); // updating contacs of selected ids 

you can collect ids of whitelist in stringbuffer, set contentvalues contentvalues.put(contacts.send_to_voicemail, 1) , change code not in (


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -