I have problems on some devices with reading contacts below you have a picture with detail of error !
Problem on Nexus 4, with Android 4.4.4!!
Could you give me any hints where should I search for the problem ?
Error was send by a tester so I can not ceck the logs!
Code works great on other devices .
thank you !
https://www.dropbox.com/s/c9n7t49nun54qw8/err.png?dl=0
Problem on Nexus 4, with Android 4.4.4!!
Could you give me any hints where should I search for the problem ?
Error was send by a tester so I can not ceck the logs!
Code works great on other devices .
thank you !
https://www.dropbox.com/s/c9n7t49nun54qw8/err.png?dl=0
B4X:
ProgressDialogShow(tr.Toast("Va rugam asteptati!"))
view_aliases.Left=Activity.Width
sincronizare_contacte
ct_list.Sort(True)
view_agenda.Clear
For i=0 To ct_list.Size-1
Try
Dim item As String
item=ct_list.Get(i)
If item.Contains(",") Then
Dim elem() As String
elem=Regex.Split(",",item)
'DisplayName=alexaserena@yahoo.com, PhoneNumber=, Starred=false, Id=221, Notes=, TimesContacted=10, LastTimeContacted=1403005930698, Name=alexaserena@yahoo.com
Dim pers As String
Dim nrpers As String
Dim idpers As String
If elem(7).Length>0 AND elem(1).Length>0 Then
If elem(7).IndexOf("=")>=0 AND elem(1).IndexOf("=")>=0 AND elem(3).IndexOf("=")>=0 Then
pers=elem(7).SubString(elem(7).IndexOf("=")+1)
nrpers=elem(1).SubString(elem(1).IndexOf("=")+1)
idpers=elem(3).SubString(elem(3).IndexOf("=")+1)
Else
pers=""
nrpers=""
End If
End If
If pers.Contains("@")=False Then
view_agenda.AddSingleLine2(pers,pers&","&nrpers)
End If
End If
Catch
CallSub2(hsman,"log_generator","tool_alias_click")
End Try
Next
B4X:
Sub sincronizare_contacte
Try
ctt.Initialize
ctt=ct.GetAll(False,False)
Dim sb As StringBuilder
sb.Initialize
For i=0 To ctt.Size-1
Dim ctrim As String
ctrim=ctt.Get(i)
Try 'routine gets name o contact
If ctrim.Contains(",") Then
Dim endof As Int
endof=ctrim.IndexOf(",")
ctrim=ctrim.SubString2(0,endof)
End If
Catch
End Try
sb.Append(ctrim)
Next
Dim numel As Long
numel=sb.ToString.Length 'usefull to check if user changed name of contact
'Log("Dimensiunea ctt(false,false): "&sb.ToString.Length)
'Log(sb.ToString)
If File.Exists(File.DirInternal,"ctt.txt")=False Then ' first time
DoEvents
ct_list=ct.GetAll(True,False) ' incarca in ct_list lista cu contacte din adress book
If ct_list.Size>0 Then
File.WriteString(File.DirInternal,"numel.txt",numel) 'contact names -sincronising
File.WriteString(File.DirInternal,"ctt.txt",ctt.Size) ' contacts list size -sincronising
File.WriteList(File.DirInternal,"ct_list.txt",ct_list) 'the actual file for geting number and contact name
Log("first write")
End If
Else
Dim cttnum As Long
cttnum=File.ReadString(File.DirInternal,"ctt.txt")
Dim actvalue As Long
actvalue=ctt.Size
Dim numenum As Long
If File.Exists(File.DirInternal,"numel.txt") Then
numenum=File.ReadString(File.DirInternal,"numel.txt")
End If
If actvalue <> cttnum OR numenum <> numel Then
Log("must sincronize")
If File.Exists(File.DirInternal,"ct_list.txt")=True Then
DoEvents
ct_list=ct.GetAll(True,False) ' incarca in ct_list lista cu contacte din adress book
File.Delete(File.DirInternal,"ct_list.text")
File.WriteList(File.DirInternal,"ct_list.txt",ct_list)
Log("done sinc")
End If
File.WriteString(File.DirInternal,"ctt.txt",actvalue)
File.WriteString(File.DirInternal,"numel.txt",numel)
Else
If File.Exists(File.DirInternal,"ct_list.txt")=True Then
ct_list=File.ReadList(File.DirInternal,"ct_list.txt")
End If
Log("from file")
End If
End If
Catch
CallSub2(hsman,"log_generator","sincronizare_contacte_click")
End Try
' 0displayName= , 1PhoneNumber= ,2Stared= ,3Id= ,4Notes= ,5TimesContacted= ,6name=
'wifi_data
End Sub