Thansks Mahares.
I had 2 checkboxes and get it with p.getview(0) and p.getview(1). This works good.
Now I had to made 4 checkboxes. The program crashes when I want to set checkbox 3 and 4. The boxes are visible in the form. The fields in the database ar correct. I get the following in the log-file. I get the same error when I want to save the data. Can you or someone else tell me how to solve this?
tossdag_vulchecks (java line: 923)
java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.CompoundButton
at anywheresoftware.b4a.objects.B4XViewWrapper.setChecked(B4XViewWrapper.java:290)
at andredamen.tossavonden.tossdag._vulchecks(tossdag.java:923)
at andredamen.tossavonden.tossdag._activity_create(tossdag.java:420)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at andredamen.tossavonden.tossdag.afterFirstLayout(tossdag.java:105)
at andredamen.tossavonden.tossdag.access$000(tossdag.java:17)
at andredamen.tossavonden.tossdag$WaitForLayout.run(tossdag.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8512)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
For x = 0 To CustomListView1.Size -1
Dim p As B4XView = CustomListView1.GetPanel(x)
DeelnemerID= CustomListView1.GetValue(x)
txt = "SELECT * FROM " & Main.DBTableName4 & " where IDdeelnemer = '"& DeelnemerID & "' and datum = '"& Main.WelkeTossDatum & "' "
Cursor1 = Main.SQL2.ExecQuery(txt)
If Cursor1.RowCount <> 0 Then
Cursor1.Position=0
If Cursor1.GetInt("tijd1") = 0 Then p.GetView(0).Checked=False Else p.GetView(0).Checked = True
If Cursor1.GetInt("tijd2") = 0 Then p.GetView(1).Checked=False Else p.GetView(1).Checked = True
If Cursor1.GetInt("tijd3") = 0 Then p.GetView(2).Checked=False Else p.GetView(2).Checked = True
If Cursor1.GetInt("tijd4") = 0 Then p.GetView(3).Checked=False Else p.GetView(3).Checked = True
End If
Next
For x = 0 To CustomListView1.Size -1
Dim ListOfMaps As List
ListOfMaps.Initialize
Dim m As Map
m.Initialize
DeelnemerID= CustomListView1.GetValue(x)
txt = "SELECT * FROM " & Main.DBTableName & " where IDnummer = '"& DeelnemerID & "' "
Cursor1 = Main.SQL2.ExecQuery(txt)
Cursor1.Position=0
txt = Cursor1.GetString("Naam")
Dim p As B4XView = CustomListView1.GetPanel(x)
m.Put("IDdeelnemer", DeelnemerID)
m.Put("naam", txt)
m.Put("datum", Main.WelkeTossDatum)
m.Put("tijd1", p.GetView(0).Checked)
m.Put("tijd2", p.GetView(1).Checked)
m.Put("tijd3", p.GetView(2).Checked)
m.Put("tijd4", p.GetView(3).Checked)
ListOfMaps.Add(m)
DBUtils.InsertMaps(Main.SQL1,Main.DBTableName4, ListOfMaps)
Next
Cursor1.Close