Private Sub Button1_Click
Dim SQL As SQL
Dim name_db As String = "teste.db"
Wait For (File.CopyAsync(File.DirAssets, name_db, File.DirApp, name_db)) Complete (Success As Boolean)
Log("Success: " & Success)
SQL.InitializeSQLite(File.DirApp, name_db, False)
'https://www.b4x.com/android/forum/threads/dbutils-example.34611/#content
'- ExecuteSpinner and ExecuteListView were removed.
'DBUtils.ExecuteSpinner(SQL, "SELECT strftime('%Y', datein) As Year FROM payables order by cid desc", Null, 0, spnryr)
ExecuteSpinner(SQL, "SELECT strftime('%Y', datein) As Year FROM payables order by cid desc", Null, 0, spnryr)
End Sub
Sub ExecuteSpinner(xsql As SQL, xquery As String, xstring_args() As String, xlimit As Int, xspinner As Spinner)
Dim itens As List
itens.Initialize
itens.Clear
Dim Table As List
Table = DBUtils.ExecuteMemoryTable(xsql, xquery, xstring_args, xlimit)
Dim Cols() As String
For i = 0 To Table.Size - 1
Cols = Table.Get(i)
#if b4a
xspinner.Add(Cols(0))
#End If
#if b4j
itens.Add(Cols(0))
#End If
Next
#if b4j
xspinner.SetListItems(itens)
#End If
End Sub