How to change the sampleImages data?
rakeshg147 opened this issue · 1 comments
rakeshg147 commented
I have set three images in sampleImages array.
On click of a button, i want to change the images. When i set new data to sampleImages, the listener does not get called. When is the listener invoked? How do I change the data? Any help is appreciated.
E-Mwaurer commented
@rakeshg147 This is what I did and it works like charm.
I had to reset the pageCount to the size of the new array like
btnChange.setOnClickListener {
// reset your array to hold a set of new images
sampleImages = intArrayOf(
R.drawable.ic_image_2,
R.drawable.ic_image_3,
R.drawable.ic_image_4
)
// don't forget to set the carousel page count to the size of new array of images
customCarouselView.pageCount = sampleImages.size
}
which worked like charm.