I've created a custom view in a library called "MyCustomView". I've added the library to a new project and then added the customview to a layout file.
I set the tag property in the designer to "myView" on the custom view. This layout file containing the CustomView from the library is loaded into various panels on a scroll view.
At a future point, I need to iterate though the views on the panel looking for the custom view and then access custom properties on the custom view:
This works fine for the regular views, however I get an error compiling when I try to assign the CustomView:
How can I coerce the "View" object type into my customview type?
I set the tag property in the designer to "myView" on the custom view. This layout file containing the CustomView from the library is loaded into various panels on a scroll view.
At a future point, I need to iterate though the views on the panel looking for the custom view and then access custom properties on the custom view:
B4X:
Dim poLabel As Label
Dim poImv As ImageView
Dim poMyCV As MyCustomView
For Each poView As View In oPan.GetAllViewsRecursive
Dim psTag As String = poView.Tag
Select Case psTag
Case "myLabel"
poLabel = poView
Case "myImage"
poImv = poView
Case "myView"
poMyCV = poView
End Select
Next
poLabel.Text = "New label text"
poMyCv.MyProperty = "New custom value"
This works fine for the regular views, however I get an error compiling when I try to assign the CustomView:
B4X:
poMyCV = poView
javac 1.8.0_101
src\phx\project\main.java:800: error: incompatible types: View cannot be converted to mycustomview
_pomycv = (phx.mycustomview.mycustomview)(_poview.getObject());
How can I coerce the "View" object type into my customview type?