Hi..
I was looking to add a string of days as items to a combobox and also change typeface:
B4X:
Dim cs As CSBuilder
Dim myFont As Typeface = Typeface.CreateNew(Typeface.LoadFromAssets("myfont.ttf"), Typeface.STYLE_BOLD)
Dim s() As String =Array ("-","7","10","14","30","60","90","180","365")
For i=0 To s.Length -1
spnrmks.cmbBox.Addall(Array (cs.Initialize.Typeface(myFont).Append(i).PopAll))
Next
But I am getting error:
java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.String[]
Adding items to a list and then changing typeface works fine as follows:
B4X:
Dim s As List
s.Initialize
s.AddAll(Array As String ("-","7","10","14","30","60","90","180","365") )
For Each day As String In s
spndays.cmbBox.Addall(Array(cs.Initialize.Typeface(myFont).Append(day).PopAll))
Next
Erel... I can use spndays.setitems(s) to add items to the combobox. But how do I change the typeface in this code line? Thnx
Dim Items As List
Items.Initialize
Dim s As List
s.Initialize
s.AddAll(Array As String ("-","7","10","14","30","60","90","180","365") )
For Each day As String In s
Items.Add(cs.Initialize.Typeface(myFont).Append(day).PopAll)
Next
spndays.SetItems(Items)