Android Question Array of FloatLabeledEditText views

Tronak

Member
Licensed User
Longtime User
Hi all,

I'm trying to add an array:

Private fEdits(10) As FloatLabeledEditText

But when initializing:

fEdits(intOrder).Initialize("fEditText")

it says Boo:

java.lang.RuntimeException: Object should first be initialized (FloatLabeledEditText).

I'm scared.

Some help, please?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
FloatLabeledEditText is designed as a custom view. You should add it with the designer.
You can create a layout file with a single FloatLabeledEditText and add it multiple times:

upload_2016-5-29_8-14-10.png


B4X:
Sub Globals
   Private FloatLabeledEditText1 As FloatLabeledEditText
   Private fEdits As List
End Sub

Sub Activity_Create(FirstTime As Boolean)
   fEdits.Initialize
   For i = 0 To 9
     Activity.LoadLayout("1") 'layout with a single FloatLabeledEditText named FloatLabeledEditText1
     fEdits.Add(FloatLabeledEditText1)
   Next
   For i = 0 To fEdits.Size - 1
     Dim fe As FloatLabeledEditText = fEdits.Get(i)
     fe.Hint = $"FloatLabeldEditText #${i}"$
     fe.SetLayout(10dip, 60dip * i, 200dip, 50dip)
   Next
End Sub
 
Upvote 0
Top