Android Question Updating text property based on tag value

JMW

Member
Licensed User
Longtime User
I am using the following to change the text property of a bunch of views based on the tag property.

B4X:
Sub btnClearAll_Click
   For i = 0 To Activity.NumberOfViews - 1
     Dim v As View
     v = Activity.GetView(i)
     If v.Tag=1 Then
       v.text = ""
     End If
   Next
End Sub

I am getting Unknown member: text in the log
can the text property not be updated this way?
 

DonManfred

Expert
Licensed User
Longtime User
Not all viewd does have a Text Property
You should only put the tag 1 on views which does have a text property.
 
Upvote 0

JMW

Member
Licensed User
Longtime User
I went through and double-checked that only edittext views have a tag property of 1.
Just to ensure I tested

B4X:
Sub btnClearAll_Click
   For i = 0 To Activity.NumberOfViews - 1
     Dim v As View
     v = Activity.GetView(i)
     If v is EditText then
       If v.Tag=1 Then
         v.text = ""
       End If
     End if
  Next
End Sub

still same error in the log
Unknown member: text
 
Upvote 0

JMW

Member
Licensed User
Longtime User
Thank you. That cleared the error in the log, but it doesn't work in testing - the edittext views don't clear their values.

But nevermind, I'll take a different approach - update the database and refresh the display.
 
Upvote 0
Top