Android Question Custom view layout optimization

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi to all!
I've a CustomView that is based on BCTextEngine and BBLabel. As i cannot understand how to add BBLabel programmatically (BBLabel has not a method like addToParent), i placed it in Layout.
I tried to load the layout in mbase of CustomView, but to achieve this in DesignerCreateView i need to place a sleep(0). This sleep(0) will make "slow" the loading of custom view (i noticed a few ms after loading activity is fully loaded to get the view layout ready). Is there a way to achieve this without use sleep(0)?
I thought i can use base_resize to load the layout, by using a boolean var to set it only first time, but i want to know if there is a better tip to do this.
Thanks to all
 

Emme Developer

Well-Known Member
Licensed User
Longtime User
Yes but it's the same

Sleep(0) will not make the loading slow. If it is slow then something else causes it.
One possible solution is to show a place holder (panel) and then load the BBLabel to this panel.

If you plan to add multiple copies of this custom view then you should resuse the same text engine.
I will try different things. I plan to add multiple copies of my view, how can i share the same text engine? Can i initialize the engine in activity and then pass it at the customview?
 
Upvote 0
Top