German ClassCastException

komfa

New Member
Licensed User
Longtime User
Hallo und guten Tag

Ich bin noch recht neu in B4A und schreibe gerade eine App welche eine SQLite DB ausliest und die Einträge in EditText-Boxen auswirft. Im Emulator klappt alles wunderbar sobald ich aber entweder eine ReleaseVersion erstelle oder ein LegacyDebug mache bekomme ich eine ClassCastException.

B4X:
Sub display
        display_x(scv2)
        display_x(scv3)
        display_x(scv4)
        display_x(scv5)
        display_x(scv6)
End Sub

Sub display_x (scv As ScrollView)
   
    Dim myEditText As EditText
    Dim myCheckBox As CheckBox
    Dim i As Int
    Dim dummyET As String
    Dim dummyCB As String
   
    For i = 0 To scv.Panel.NumberOfViews -1
    myEditText = scv.Panel.GetView(i)
    dummyET = myEditText.Tag
    myCheckBox = scv.Panel.GetView(i)
    dummyCB = myCheckBox.Tag


    If dummyET.Length > 0 OR dummyCB.Length > 0 Then
        If scv.Panel.GetView(i) Is EditText Then
            If cursor1.GetString(myEditText.Tag) <> "?" Then
                myEditText.Text = cursor1.GetString(myEditText.Tag)
            Else
                myEditText.Text = ""
            End If
        End If
        If scv.Panel.GetView(i) Is CheckBox Then
            If cursor1.GetString(myCheckBox.Tag) = 1 Then
                myCheckBox.Checked = True
            Else If    cursor1.GetString(myCheckBox.Tag) = 0 Then
                myCheckBox.Checked =  False
            End If
        End If
    End If
    Next   
End Sub

Fehler:
main_display_x (B4A line: 437)
myEditText = scv.Panel.GetView(i)
java.lang.ClassCastException: anywheresoftware.b4a.BALayout cannot be cast to android.widget.EditText


at b4a.example.main._display_x(main.java:1224)
at b4a.example.main._display(main.java:1292)
at b4a.example.main._filter_alles(main.java:1326)
at b4a.example.main._btn_alles_click(main.java:501)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:158)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:64)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)


Mfg Benny
 
Top