question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clear sliderViews from SliderLayout didn't clear previous images

See original GitHub issue

I want to clear slider before add another slider, but the previous image didn’t clear.

private fun setSliderViews(bannerArr: JsonArray) {
        if (imageSlider != null) {
            imageSlider.clearSliderViews()
        }
        val sliderView = DefaultSliderView(requireContext())

        for (i in 0 until bannerArr.size()) {
            val bannerObj = bannerArr[i].asJsonObject
            sliderView.imageUrl = bannerObj.get("image_url").asString
            

            if (imageSlider != null) {
                imageSlider.addSliderView(sliderView)
            }
        }
    }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tamtomcommented, May 5, 2019

You can check this library https://github.com/OpenSooq/Pluto it has the ability to have full control over your views and layout and not depending on any image library

0reactions
smarteistcommented, May 28, 2019

I want to clear slider before add another slider, but the previous image didn’t clear.

private fun setSliderViews(bannerArr: JsonArray) {
        if (imageSlider != null) {
            imageSlider.clearSliderViews()
        }
        val sliderView = DefaultSliderView(requireContext())

        for (i in 0 until bannerArr.size()) {
            val bannerObj = bannerArr[i].asJsonObject
            sliderView.imageUrl = bannerObj.get("image_url").asString
            

            if (imageSlider != null) {
                imageSlider.addSliderView(sliderView)
            }
        }
    }

Update to 1.3.0 , and use SliderAdapter , you can clear adapter and call notifyDataSetChanged(); it should clear sliderLayout like a charm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AndroidImageSlider library memory leak - Stack Overflow
I use it in my project and it perfectly fulfills all the needs. The only trouble is memory leak which occurs after fragment...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found