Android Question label object in a list

Pietro Pancino

Member
Licensed User
Longtime User
Hi all,
I have an application with several labels on the screen.

20201207_140835.jpg

I need to move and change width of those label dynamical without accessing directly to the label Object. (label1.left =...)
So I feed a list with label name :
appending the list:
the_event_list.AddAll (Array As Label (Label1,Label2,Label3,Label4))

After that I wanted to change dynamicaly the label position accessing to him throught the list like this:
B4X:
Sub move_the_label (label_num As Int)
    Dim the_label As Label = the_event_list.Get(label_num)
    Dim the_left As Int = the_label.Left + 2
    the_label.Left = the_left
End Sub

and ... it doesn't work :-(, It seems the label object is not transfered from the list. It give a textview type, but not a label when I log the list content...

I thought that we could get the full object attribute from an object in a list, but i certainly miss some thing.

I have joined the a sample project that don't work... of course :)

If any one have an idea.

Pietro
 

Attachments

  • label_object_in_a_list.zip
    9.7 KB · Views: 198
Top