Android Question Initializing ImageSlider

Martin Larsen

Active Member
Licensed User
Longtime User
I am trying to implement the image slider in my app.

B4A keeps complaining that the slider is not initialized. And if I run it anyway, I get an exception.

The slider is added from the Visual Designer and the Dim statement and the event is generated via right click in the designer and thus is shouldn't need an explicit initialization. Also, the examples don't initialize it.

What could be the reason?

After struggling for a couple of hours, I am clueless....
 

DonManfred

Expert
Licensed User
Longtime User
Usage:

1. Add ImageSlider with the designer.
2. Set the number of images:
3. Implement the GetImage event. This is a resumable sub.
You should return a B4XBitmap based on the index.
 
Upvote 0

Martin Larsen

Active Member
Licensed User
Longtime User
It's a commercial app I am working on so I can't upload it. However, when preparing a test project for you to see, I actually found the cause.

In the app (XUI) I have delegated must of the work to a separate module that loads the layout etc. However, the auto generated stub and Dim statement was created in the main activity, not the module. That's why it was uninitialized.

I moved the Dim and event handler to the correct module and then it worked.
 
Last edited:
Upvote 0
Top