Thanks Erel, this will be useful as well, your code appears to be a list of all available accounts. Fortunately it pointed me in the right direction.
I modified one of the other routines and was able to get what I needed. Here is the code:
Public Sub GetAccounts2(Id As Long) As String
Dim crsr As Cursor = cr.Query(dataUri, Array As String("account_name", "account_type"), "_id = ?", Array As String(Id), "")
If crsr.RowCount > 0 Then
crsr.Position = 0
'ToastMessageShow(crsr.RowCount, False)
Dim Acct As String = crsr.GetString("account_name") & " Type: " & crsr.GetString("account_type")
Else
Acct = "None!"
End If
crsr.Close
Return Acct
End Sub
For those as slow as me this (and Erel's funcition above were added to the ContactUtils Module of the ContactUtils example.
I then modified Main as below:
Sub lstContacts_ItemClick (Position As Int, Value As Object)
Dim c As cuContact = Value
Dim bmp As Bitmap = cu.GetPhoto(c.Id)
If bmp.IsInitialized Then ImageView1.SetBackgroundImage(bmp) Else ImageView1.SetBackgroundImage(Null)
Dim sb As StringBuilder
sb.Initialize
sb.Append(c.DisplayName).Append(CRLF).Append("Note: ").Append(cu.GetNote(c.Id)).Append(CRLF)
sb.Append("Starred: ").Append(cu.GetStarred(c.Id)).Append(CRLF)
For Each phone As cuPhone In cu.GetPhones(c.Id)
sb.Append(phone.Number & ", " & phone.PhoneType).Append(CRLF)
Next
For Each email As cuEmail In cu.GetEmails(c.Id)
sb.Append(email.email).Append(", ").Append(email.EmailType).Append(CRLF)
Next
sb.Append("Provider: ").Append(cu.GetAccounts2(c.Id)).Append(CRLF)
EditText1.Text = sb.ToString
End Sub
Adding the line
sb.Append("Provider: ").Append(cu.GetAccounts2(c.Id)).Append(CRLF)
Note I am not yet using GetAccounts