I added the Sub to ContactsUtils added the following code:
...
Dim b() As Byte = Bit.InputStreamToBytes(File.OpenInput(File.DirAssets, "up.png"))
cu.SetPhoto(121, b) ' 121 is a specific contact record in lieu of c.id
Msgbox("An instance of " & EditText1.Text & " was found in the Device and adjusted.","")
Activity.Finish
...
The code passes through ContactUtils but nothing happens - no picture is changed, no hits, no errors. What am I doing wrong? Thanks
the same happen to me, try to add a contact with the code but nothing, is there a chance that have to refresh something at the contact list to update the photo for the contact? if so how to do it?
Code:
Sub Label10_Click
Dim b() As Byte = Bit.InputStreamToBytes(File.OpenInput(File.DirAssets, "up.png"))
cu.SetPhoto(79,b)
Msgbox("Photo Updated.","")
End Sub
Public Sub SetPhoto(Id As Long, Image() As Byte)
Dim v As ContentValues
v.Initialize
v.PutBytes("data15", Image)
Dim bmp As Bitmap = GetPhoto(Id)
SetData("vnd.android.cursor.item/photo", v, Id, bmp.IsInitialized)
End Sub