I am making a sub that changes all EditText TextColor property in a Activity.
But its crash in this line:
Dim textBox As EditText = vw
Error:
java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
What am I doing wrong?
Here is the code:
But its crash in this line:
Dim textBox As EditText = vw
Error:
java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
What am I doing wrong?
Here is the code:
B4X:
Sub SetEditText_Textcolor(ActivityName As Activity, ForegroundColor As Int)
Dim i As Int
Dim vw As View
For i = 0 To ActivityName.NumberOfViews - 1
vw = ActivityName.GetView(i)
If GetType(vw).IndexOf("TextView") > 0 Then
'If vw Is EditText Then ' DO NOT WORK
Dim textBox As EditText = vw '// This Line CRASH
textBox.TextColor = ForegroundColor
End If
Next
End Sub