Hello everybody,
i can't make 'list.sort' work, i get an error while i'm running the debug mode.
In practice i want to display a list of contacts in alphabetical order based on what i'm typing into EditText field.
Can you help me?
Thank you!
Omar
:sign0104:
A couple of questions more:
1) In Sub btnSearch_Click, i put the line:
inside the second for loop without a logical reason, just because it was giving me error both between the two 'Next' and outside the for loops.
2) When i have the app running and i click on one item of the listView it doesn't execute anything inside the Sub ListView1_ItemClick (Position As Int, Value As Object).
i can't make 'list.sort' work, i get an error while i'm running the debug mode.
In practice i want to display a list of contacts in alphabetical order based on what i'm typing into EditText field.
Can you help me?
Thank you!
Omar
:sign0104:
A couple of questions more:
1) In Sub btnSearch_Click, i put the line:
B4X:
ListView1.AddTwoLines2(Contatto(i).DisplayName, PhoneNo.GetKeyAt(p), i)
inside the second for loop without a logical reason, just because it was giving me error both between the two 'Next' and outside the for loops.
2) When i have the app running and i click on one item of the listView it doesn't execute anything inside the Sub ListView1_ItemClick (Position As Int, Value As Object).
B4X:
Sub Globals
Dim Contatti As Contacts2
Dim Rubrica As List
Dim edtName As EditText
Dim ContattoSingolo As Map
Dim ListView1 As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("RicercaContatto")
ListView1.Initialize("Rubrica")
Activity.AddView(ListView1, 0, 100, 480, 600)
End Sub
Sub btnSearch_Click
ListView1.Clear
Rubrica = Contatti.FindByName(edtName.Text, False, True, False)
For i = 0 To Rubrica.Size -1
Dim Contatto(Rubrica.Size) As Contact
Contatto(i) = Rubrica.Get(i)
Dim ListaABC As List
ListaABC.Initialize2(Contatto)
ListaABC.Sort(True)
Dim PhoneNo As Map
PhoneNo = Contatto(i).GetPhones
For p = 0 To PhoneNo.Size -1
ListView1.AddTwoLines2(Contatto(i).DisplayName, PhoneNo.GetKeyAt(p), i)
Next
Next
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
Activity.Title = Value
End Sub
Last edited: