Android Question How to use Lazy Loading on this Customlistview

Makumbi

Well-Known Member
Licensed User
B4X:
#Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: True
#End Region

Sub Process_Globals
    Public SQL1 As SQL
End Sub

Sub Service_Create
    
    File.Delete(File.DirInternal, "Data.db")    'for test purposes
    
    If File.Exists(File.DirInternal, "Data.db") = False Then
        SQL1.Initialize(File.DirInternal, "Data.db", True)
        Private Query As String
        ' i have created one table as per your advice
        'The category filed shows recieved and sent messages.
        ' After i know want to find a way of passing the message to this table and later retrieve the conversation of the selected user
        Query = "CREATE TABLE smsdata (sms TEXT , Category TEXT, Date TEXT, Names TEXT)"
        SQL1.ExecNonQuery(Query)
        
        ''The below is the list of my users where i would what to select from and then send the messages.
        SQL1.ExecNonQuery("DROP TABLE IF EXISTS Students")
        Query = "CREATE TABLE Students (Names Text, ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE)"
        SQL1.ExecNonQuery(Query)
        Query = "INSERT INTO Students VALUES ('James', '1')"
        
        Query = "INSERT INTO Students Values ('Peter', '2')"
        SQL1.ExecNonQuery(Query)

    Else
        SQL1.Initialize(File.DirInternal, "Data.db", True)
    End If
    
End Sub

Sub Service_Start (StartingIntent As Intent)
    Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
End Sub

Sub Service_TaskRemoved
    'This event will be raised when the user removes the app from the recent apps list.
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Service_Destroy

End Sub

How can use lazy loading to implement this cause i want to insert the messages in one table then later retrieve them
 

Attachments

  • Backup Chat 2020-03-10 08.39.zip
    11.7 KB · Views: 166
  • Screenshot_1581681903.png
    Screenshot_1581681903.png
    45.1 KB · Views: 213

Peter Simpson

Expert
Licensed User
Longtime User
Upvote 0
Top