Android Question B4J: Code Works - B4A: Cannot cast CustomView to TextView

LWGShane

Well-Known Member
Licensed User
Longtime User
I'm working on a very, very simple player select control and it works perfect in B4J. I started working on the B4A version and it doesn't work. It claims that I'm casting my custom control to a TextView, which obviously I'm not.
 

Attachments

  • PlayerSelectView.zip
    13.3 KB · Views: 152

teddybear

Well-Known Member
Licensed User
You need to add sleep before loadlayout

B4X:
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
    mBase = Base
    Tag = mBase.Tag
    mBase.Tag = Me
    Sleep(0) '<===Add it
    mBase.LoadLayout("LWGPlayerSelectMainView")
End Sub
 
Upvote 1

LWGShane

Well-Known Member
Licensed User
Longtime User
@teddybear
Yeah, I read about that but.... My dumbass put "Sleep(0)" after the call to LoadLayout.

Now I put it before the LoadLayout call and it works perfectly; thank you :)
 
Upvote 0
Top