Giter VIP home page Giter VIP logo

Comments (7)

zzzzzzzzoli avatar zzzzzzzzoli commented on June 11, 2024 1

In my case the problem was that the library expects the context to be AppCompatActivity (which my activity is) but getContext() returns ContextWrapper.
So I imported the library and changed its code starting at line 123 of BannerSlider.java to this:

if (getContext() instanceof AppCompatActivity) {
                        hostActivity = (AppCompatActivity) getContext();
                    } else if (getContext() instanceof ContextWrapper && ((ContextWrapper) getContext()).getBaseContext() instanceof AppCompatActivity) {
                        hostActivity = (AppCompatActivity)((ContextWrapper)getContext()).getBaseContext();
                    } else {
                        throw new RuntimeException("Host activity must extend AppCompatActivity");
                    }

Also, when I added no indicators the library crashed, that was solved by changing

slideIndicatorsGroup.onSlideAdd();

to

if (!hideIndicators) {
    slideIndicatorsGroup.onSlideAdd();
}

in method setBanners of BannerSlider.java

from banner-slider.

deep1931 avatar deep1931 commented on June 11, 2024

how you found the solution because i am facing the same issue..
java.lang.RuntimeException: Host activity must extend AppCompatActivity
at ss.com.bannerslider.views.BannerSlider$1.run(BannerSlider.java:124)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6153)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)

from banner-slider.

KingIdee avatar KingIdee commented on June 11, 2024

Experienced same issue. And I need this feature in a production app by tomorrow. Any help, or any other library suggestion ?

from banner-slider.

deep1931 avatar deep1931 commented on June 11, 2024

I have fixed this issue but not remember now how i did. but you can use this library
https://github.com/daimajia/AndroidImageSlider

from banner-slider.

hassaanjamil avatar hassaanjamil commented on June 11, 2024

I am facing the same issue as @Frankenstein666 is facing, any help will be appreciated.

from banner-slider.

deep1931 avatar deep1931 commented on June 11, 2024

from banner-slider.

saeedsh92 avatar saeedsh92 commented on June 11, 2024

The host activity of this library must extend the AppCompatActivity

from banner-slider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.