Hi All,

I am able to insert the contacts into SIM card and delete from it. But
it needs to be phone restart to update the changes.

The below is the code woks for delete the conatcs,

Uri simUri = Uri.parse("content://icc/adn");
                        Cursor cur = context.getContentResolver().query(simUri, 
null,
null, null, null);
                        prn("Number of SIM Contacts are.."+cur.getCount());
                        int row =0;
                        while(cur.moveToNext()){
                                String name = 
cur.getString(cur.getColumnIndex("name"));
                                prn("Name..."+name);
                                String data = 
cur.getString(cur.getColumnIndex("number"));
                                if(!data.equals(""))
                                        prn("Number.."+data);
                                String where = null;
                                if(!name.equals("") && !data.equals("")){
                                        where = "tag =" + name + "AND" + 
"number =" +data;
                                }
                                else if(name.equals("") && !data.equals("")){
                                        where = "number ="+data;
                                }
                                else {
                                        where = "tag ="+name+ "AND" 
+"number="+null;
                                }

                                context.getContentResolver().delete(simUri, 
where, null);
                                row++;
                        }
                        prn(row+" are deleted");
                        cur.close();
                        cur = null;

Please look into this issue and give suggestions on this.

Thanks,
Girish G M

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to