Hi, so far, really liking B4A and find it very familiar and easy to use. However, I'm running into an issue I've searched for and have not found an answer for.
I get the error "java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText" when trying to run the following code:
or
I wrapped with an if/then which makes it run correctly other times, but at least 50% of the time, it still gives the above error:
I only need to test against EditText views, and if I try:
then I get an error "Unknown Member: Text"
For now, there are only 8 EditText views on the activity, so I just set up a sub to set them to blank, but I have a couple of Activities lined up that will have several EditText views and I'll need an easy way to batch work with the text in them.
I get the error "java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText" when trying to run the following code:
B4X:
For Each et as EditText in Activity
et.text = ""
Next
or
B4X:
For Each et as EditText in Activity
If isnumber(et.text) then
<code>
End If
Next
I wrapped with an if/then which makes it run correctly other times, but at least 50% of the time, it still gives the above error:
B4X:
For Each et as EditText in Activity
If et is EditText then
et.text = ""
End If
Next
B4X:
For Each et as View in Activity
If et is EditText Then
et.text = ""
End If
Next
For now, there are only 8 EditText views on the activity, so I just set up a sub to set them to blank, but I have a couple of Activities lined up that will have several EditText views and I'll need an easy way to batch work with the text in them.