Hello everyone, I'm trying to figure out how to change an example NjDude had sent me on the forum, it is a popular SQL database where a dispute through a editext spinner and a button, now I want popular 6 spinner through a editext, as I do?
I enclose an example of NjDude where you can only populate a spinner.
i hope in your help
I enclose an example of NjDude where you can only populate a spinner.
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim dbSQL As SQL
Dim dbCursor As Cursor
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Spinner1 As Spinner
Dim EditText1 As EditText
Dim Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
If File.Exists(File.DirDefaultExternal, "Test.db") = False Then
File.Copy(File.DirAssets, "Test.db", File.DirDefaultExternal, "Test.db")
End If
dbSQL.Initialize(File.DirDefaultExternal, "Test.db", True)
PopulateSpinner
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
'##########################
'######## Controls ########
'##########################
Sub Button1_Click
dbSQL.ExecNonQuery2("INSERT INTO Field1 VALUES (?)", Array As String(EditText1.Text))
Spinner1.Add(EditText1.Text)
EditText1.Text = ""
dbCursor.Close
End Sub
'##########################
'######## Routines ########
'##########################
Sub PopulateSpinner
dbCursor = dbSQL.ExecQuery("SELECT * FROM Field1")
For I = 0 To dbCursor.RowCount - 1
DoEvents
dbCursor.Position = I
Spinner1.Add(dbCursor.GetString("Data"))
Next
dbCursor.Close
End Sub
i hope in your help