Android Question [QUESTION] Extract CustomView TAG - FloatLabelEditText TAG

konradwalsh

Active Member
Licensed User
Longtime User
I cant seem to extract FloatLabelEditText's TAG
It returns null.
this is the methods I have tried

B4X:
For Each v As View In panTreasures.GetAllViewsRecursive
    If v Is EditText Then
        Dim e As EditText
      e = v
      Log("ET " & e.tag)
    End If 
    Try
  
         If v Is FloatLabeledEditText Then
        Dim e1 As FloatLabeledEditText
  
          e1 = v
      Log("FL " & e1.EditText.Tag)
    End If 
    Catch
        Log(LastException)
    End Try

Next
Log("====== ")
Try
    For i = 0 To panTreasures.NumberOfViews - 1
                   If panTreasures.GetView(i) Is FloatLabeledEditText Then
                      Log("====== " & panTreasures.GetView(i))
                    Dim e2 As FloatLabeledEditText
                    e2 = panTreasures.GetView(i)
                    Log("E2  " & e2.EditText.Tag)
                   End If
            Next
Catch
    Log(LastException)
End Try
  
          
          
    Log("====== ")
 

DonManfred

Expert
Licensed User
Longtime User
have you tried

B4X:
If v Is FloatLabeledEditText Then
  Dim e1 As FloatLabeledEditText = v
  dim et as edittext = e1.EditText
  Log("FL " & et.Tag)
 
Upvote 0

konradwalsh

Active Member
Licensed User
Longtime User
Also in the designer View

Simply as this
In designer - Place a FloatLabelEditText
Set its Name and Text Value and Tag to Match the name

then back in my activity code, try to extract the details
 
Upvote 0

konradwalsh

Active Member
Licensed User
Longtime User
Just to highlight, my goal here is to iterate over the FloatLabeledEditTexts and extract the Name and Value to store in a DB
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Which version of the ViewsEx Lib are you using?

It looks, from version 1.11 that it should return Tag which is a java.lang.Object...

Are you sure you've set the Tag?

You haven't initialized the View in code anywhere? or something?

It feels like it will be one of 'those annoying' issues where either you're looking at a View that hasn't actually got it set - whereas all others do or it's been initialiased somewhere and the value of the tag has been lost/overwritten..

Have you tried a barebones test of this? Just the View and retrieving the Tag? Does that work - may well help to prove it works..
 
Upvote 0
Top