Search code examples
basic4android

Do you always need to initialize in basic4android?


Do I need to initialize everything before I use it in basic4android?

Dim lbl as label
Dim lv1 as listview

lbl.initialize()
lv1.initialize()

lbl1.text = "Hello world!"

Solution

  • Only if you are creating the layout programmatically. If you create it with the designer you do not need to initialize the views. Another case where you do not need to initialize is when you reference an already initialized view:

    Dim lbl1, lbl2 As Label
    lbl1.Initialize("")
    lbl2 = lbl1
    lbl2.Text = "efwef"