Hi all.
I have this code:
Now this code works ( '***********This Delete number to Contact and work ) and delete numbers from phone contacts, in each case in the memory of the sim are still present. Then use the second piece of code ('*********** This Delete number to Sim) donw work and also:
1) also i have "where" in the query with the name, returned 3 records (all existing contacts on the sim)
2) Do not perform any data deletion
Any idea or solution ??
Thanik you
Marco
I have this code:
B4X:
'Cancella
'Deletes the contact with the given name.
Sub DeleteContactByName(Name As String)
'***********This Delete number to Contact and work
Dim u As Uri
u.Parse("content://com.android.contacts/data")
Dim crsr As Cursor = cr.Query(u, Array As String("_id", "raw_contact_id"), _
"mimetype = ? AND data1 = ?", Array As String("vnd.android.cursor.item/name", Name), "")
For i = 0 To crsr.RowCount - 1
crsr.Position = i
Dim rawId As Long = crsr.GetLong("raw_contact_id")
Log(cr.Delete(u, "raw_contact_id = ?", Array As String(rawId)))
Dim u2 As Uri
u2.Parse("content://com.android.contacts/raw_contacts")
Log(cr.Delete(u2, "_id = ?", Array As String(rawId)))
Next
crsr.Close
'******** End Delete number to contact
'*********** This Delete number to Sim
Dim simUri As Uri
simUri.Parse("content://icc/adn")
Dim crsr1 As Cursor = cr.Query(simUri, Array As String("_id","name","number"), "name = ?", Array As String(Name), "")
For i = 0 To crsr1.RowCount - 1
crsr1.Position = i
Dim rawId1 As Long = crsr1.GetLong("_id")
Log(cr.Delete(simUri, "_id = ?", Array As String(rawId1)))
Next
crsr1.Close
'********** End Delete number to Sim
'Rileggo i dati
ListView2.Clear
ReadSimContacts
End Sub
Now this code works ( '***********This Delete number to Contact and work ) and delete numbers from phone contacts, in each case in the memory of the sim are still present. Then use the second piece of code ('*********** This Delete number to Sim) donw work and also:
1) also i have "where" in the query with the name, returned 3 records (all existing contacts on the sim)
2) Do not perform any data deletion
Any idea or solution ??
Thanik you
Marco