I have several iconbuttons and mist find the one with a certain tag. But when I want to work with it, I get
"java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams com.phillipcalvin.iconbutton.IconButton.getLayoutParams()' on a null object reference"
Why?
"java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams com.phillipcalvin.iconbutton.IconButton.getLayoutParams()' on a null object reference"
Why?
B4X:
Dim clickedbtn as IconButton
For Each v As View In Activity.GetAllViewsRecursive
Try
' only check iconbuttons
If v Is IconButton Then
t=v.Tag
Log (t)
If t=clickedno Then
clickedbtn=v
' the next line throws the error
Log (clickedbtn.Left & " - " & clickedbtn.Top)
End If
End If
Catch
Basis.debuginfo (LastException.Message,False)
End Try
Next