Android Question Spinner...

StephenRM

Member
When a spinner is added to 'open designer' and the code is written as,
Dim spn1 as Spinner

snp1.Initialize("spn1")
spn1.addAll(Array as String("a", "b", "c"))

It is not loaded with values.

But when coded in module,
Dim spn1 as Spinner

snp1.Initialize("spn1")
spn1.AddAll(Array as String("a", "b", "c"))
Activity.addView(spn1, l, t, w, h )

It is loaded with values.

Why is it so?
 

Star-Dust

Expert
Licensed User
Longtime User
When a spinner is added to 'open designer' and the code is written as,
Dim spn1 as Spinner

snp1.Initialize("spn1")
spn1.addAll(Array as String("a", "b", "c"))

It is not loaded with values.

But when coded in module,
Dim spn1 as Spinner

snp1.Initialize("spn1")
spn1.AddAll(Array as String("a", "b", "c"))
Activity.addView(spn1, l, t, w, h )

It is loaded with values.

Why is it so?
If you insert the view from Design you don't have to initialize it(is already initialized).
If you do that variable assigns a new view that is not anchored to any panel (and therefore not visible) and the one that is not anchored will receive the array. While the one inserted in the design will remain empty.

Then remove snp1.Initialize("spn1").Initialize
 
Upvote 0

StephenRM

Member
If you insert the view from Design you don't have to initialize it(is already initialized).
If you do that variable assigns a new view that is not anchored to any panel (and therefore not visible) and the one that is not anchored will receive the array. While the one inserted in the design will remain empty.

Then remove snp1.Initialize("spn1").Initialize
Thanks
 
Upvote 0
Top