'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim details, cName, cphone As String
Dim listOfContacts As List
Dim lvphone As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
getcontacts
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub getcontacts
Dim Contacts2 As Contacts2
listOfContacts.Initialize
listOfContacts = Contacts2.GetAll(True,False)
'Log(listOfContacts)
'listOfContacts.Sort(True)
'Log(listOfContacts)
For i = 0 To listOfContacts.Size - 1
Dim Contact As Contact
Contact = listOfContacts.Get(i)
'Log(Contact) 'will print the fields to the LogCat
If Contact.PhoneNumber <>"" Then
'If there Is a Contact number pass it To the ListView so you can see it
'lvphone.TwoLinesLayout.SecondLabel.textcolor=Colors.blue
lvphone.SingleLineLayout.Label.TextSize = 20
lvphone.SingleLineLayout.ItemHeight = 70
lvphone.AddSingleLine(Contact.DisplayName &CRLF &Contact.PhoneNumber)
'lvphone.AddTwoLines(Contact.DisplayName,Contact.PhoneNumber)
lvphone.ScrollingBackgroundColor =Colors.DarkGray
End If
Next
End Sub
Sub lvphone_ItemClick (Position As Int, Value As Object) As String
details = Value
'Log("******************************************")
'Log("selected " & details) 'the name in the logs As a check
'Log("Break found at " & details.IndexOf(CRLF))
'Log("******************************************")
cName=details.SubString2(0,details.IndexOf(CRLF))
Log("Name selected -" & cName & "-")
cphone=details.SubString2(details.IndexOf(CRLF)+1,details.Length)
Log("Phone number -" & cphone & "-")
Activity.Title=cName & "-" & cphone
Return details
End Sub