Android Question Weird warning

dexMilano

Active Member
Licensed User
Longtime User
I'm receiving a weird warning in this piece of code.

B4X:
Sub btn_changeClass_Click
' define the ChooseClass dialog using CustomDialog **************************************************
Dim cd As CustomDialog2
Dim t_strD As String
Dim retDialog As Int
Dim pnl As Panel
' using also list as lsv_dia01 and a label for breadcomb lbl_Dia01

    'ret_dia01 keep the selected class ID
    'initi ret_dia01 as current value
    ret_Dia01 = currentAct.class_id
   
    pnl.Initialize("pnl")
    Dim bgnd As ColorDrawable
    bgnd.Initialize(Colors.Black, 0dip)
    pnl.Background = bgnd
   
    lsv_Dia01.Initialize("lsvDia01")
    lbl_Dia01.Initialize("")
    pnl.AddView(lsv_Dia01, 0dip, 0dip, 500dip, 200dip)
    pnl.AddView(lbl_Dia01, 0dip, 201dip, 500dip, 30dip)
    init_lsvClsDia01
   
    cd.AddView(pnl, 400dip, 300dip) ' sizing relative to the screen size is probably best
    'pnl.SetLayout (0dip,0dip,500dip,250dip)
    retDialog = cd.Show("MP2 - My Personal Priorities", "OK", "Cancel", "", bmp_app)
    'ret_dia01 has the class_id value

    If retDialog = DialogResponse.POSITIVE AND ret_Dia01 <> currentAct.class_id Then
        t_strD = lbl_class.Text
        currentAct.class_id = retDialog
        lbl_class.Text = cls2breadcomb (ret_Dia01)
        ToastMessageShow("The class of the activity has been updated.", False)
    End If
   
End Sub

Into the line
B4X:
Dim t_strD As String
B4A tells me
"Unused variable...." and it is not true because this variable is used
B4X:
 t_strD = lbl_class.Text
.

If I remove the DIM line, I receive the obvious and correct warning
"Undeclared variable ..."


It is not critical but is it possible to understand what B4A is trying to tell me?

Thanks
 
Top