Android Question How do I code SQLite to xCLV

darkz

Member
It's hard to figure out but I want to make a simple xclv that had all the basic SQLite functions such as Add,modify,delete etc.
would be great to get a simple source codes or any example for reference

here is my xlcv code
I'm sorry I'm really confused with xlcv


code:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("layout1")
    
    Dim xui As XUI
    For i = 0 To 10
        Dim p As B4XView = xui.CreatePanel("")
        p.SetLayoutAnimated(100,0,0,100%x,40dip)
        p.LoadLayout("item")
        Label1.Text = " Item numer: " & i
        btn.Text = i
        xclv.Add(p,i)
    Next
End Sub
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
Here is an absolutely basic demonstrator, but hopefully it will get you started. It creates a simple database in File.DirInternal and then retrieves that data and displays it in a CustomListView. On subsequent invocations the database is retrieved directly from File.DirInternal.

The demo shows how to create a table, how to add records to the table, and how to retrieve values from the table and put them into a CLV. Ask if you want to know more.
 

Attachments

  • SQLclv.zip
    11.2 KB · Views: 4
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I have extended my example to demonstrate some other features of the CLV.

1. The record identifier from the database is added to the CLV items so that a clicked item can be tied back to its database entry.

2. Selected items can be deleted from the CLV and the database.

3. A button is provided to "repair and replace" the data to refresh the demonstration.

Note that this is NOT a realistic application. It is a simple example to show how data stored in a database and data listed in a CLV can be linked together.
 

Attachments

  • CLVDemo2.zip
    11 KB · Views: 0
Upvote 0
Top