Android Question How do I set a date for 12am this morning?

tsteward

Well-Known Member
Licensed User
Longtime User
I want to retrieve the phone log of all calls today. How do I set the getsince date please?

B4X:
Dim tw1 As TextWriter
    Dim mytext As String
    'Calls = CallLog.GetAll(10) 'Get the last 10 calls
    Calls = CallLog.GetSince(DateTime.Date(DateTime.Now) ,0)
    tw1.Initialize(File.OpenOutput(File.DirRootExternal, "Tony.txt",True))
    For i = 0 To Calls.Size - 1
        Dim c As CallItem
        c = Calls.Get(i)
        Dim callType, name As String
        Select c.callType
            Case c.TYPE_INCOMING
                callType="Incoming"
            Case c.TYPE_MISSED
                callType = "Missed"
            Case c.TYPE_OUTGOING
                callType = "Outgoing"
        End Select
        name = c.CachedName
        If name = "" Then name = "N/A"
        mytext = c.Number & ", " & name & ", " & callType & ", " & DateTime.Date(c.Date) & ", " & c.Duration & CRLF
        tw1.WriteLine(mytext)
    Next
    tw1.Close
 
Top