Android Question [XUI] B4XLoadingIndicator Initialize from panel not working

Alexander Stolte

Expert
Licensed User
Longtime User
Hello,

i want to use the B4XLoadingIndicator in my xcustomlistview.
The problem is this:
B4X:
Dim LayoutPanel As B4XView = xui.CreatePanel("")
LayoutPanel.SetLayoutAnimated(0, 0, 0, MyList.AsView.Width, height)
 LayoutPanel.LoadLayout(LayoutName)

    Dim loading As B4XLoadingIndicator = LayoutPanel.GetView(0) 'here is the error
The error is: Types do not match

but, i dont know, how to control the view otherwise, without this method.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Tip: custom views objects are not views*. This means that that Panel.GetView will never return a custom view instance.

You have two options:
1. Add a global variable with the name of the indicator. The global variable will point to the last added indicator.
2. If you check the code of this custom view you will see this important line:
B4X:
mBase.Tag = Me
This means that the tag property of the base view points to the custom view instance.
B4X:
Dim loading As B4XLoadingIndicator = LayoutPanel.GetView(0).Tag


*There are a few custom views that are implemented in Java or Objective C which are actually views.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Tip: custom views objects are not views*. This means that that Panel.GetView will never return a custom view instance.

You have two options:
1. Add a global variable with the name of the indicator. The global variable will point to the last added indicator.
2. If you check the code of this custom view you will see this important line:
B4X:
mBase.Tag = Me
This means that the tag property of the base view points to the custom view instance.
B4X:
Dim loading As B4XLoadingIndicator = LayoutPanel.GetView(0).Tag


*There are a few custom views that are implemented in Java or Objective C which are actually views.
Sorry if I'm off topic, but I wanted to ask if you could give an example (in a special thread) how to create a custom list in Java even simple so as to understand how to develop Java libraries with real views for bA4
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top