Android Question [SOLVED] - DBUtils Error Object not initialized

killiak

Member
Licensed User
Longtime User
Hi there, I'm trying to use DBUtils for SqlLite in my application. So far no problem. but now i have an Activity with this sentence

DBUtils.ExecuteSpinner(Starter.sql,"select * FROM spinnercat",Null,0,SpGenerico)

I declare in Globals SpGenerico as spinner.

I got an error

Error occurred on line: 222 (DBUtils)
java.lang.RuntimeException: Object should first be initialized (Spinner).

I got this error in this line from DBuitls.bas

Code:
if B4A
'Executes the query and fills the Spinner with the values in the first column
Sub ExecuteSpinner(SQL As SQL, Query As String, StringArgs() As String, Limit As Int, Spinner1 As Spinner)
    Spinner1.Clear
    Dim Table As List
    Table = ExecuteMemoryTable(SQL, Query, StringArgs, Limit)
      
    Dim Cols() As String
    For i = 0 To Table.Size - 1
        Cols = Table.Get(i)
        Spinner1.Add(Cols(0))
    Next
End Sub

Error on Spinner1.Clear (Line 222 of DButils)

Same happen with a Listview.

But in other activities i use those "SELECT *" Filler with no problem..


What I'm doing wrong? Thanks

Regards
 
I declare in Globals SpGenerico as spinner.
If you added it by code (not by Designer) you should Initialize it (SpGenerico.Initialize) in your Actvity_Create sub.
 
Upvote 0
If you added it by code (not by Designer) you should Initialize it (SpGenerico.Initialize) in your Actvity_Create sub.

Awesome, that's nail it!

Thanks
 
  • Like
Reactions: udg
Upvote 0
Back
Top