Comments (7)
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.
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.
Experienced same issue. And I need this feature in a production app by tomorrow. Any help, or any other library suggestion ?
from banner-slider.
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.
I am facing the same issue as @Frankenstein666 is facing, any help will be appreciated.
from banner-slider.
from banner-slider.
The host activity of this library must extend the AppCompatActivity
from banner-slider.
Related Issues (20)
- Error inflating class ss.com.bannerslider.Slider
- 'int ss.com.bannerslider.adapters.PositionController.getNextSlide(int)' on a null object reference HOT 4
- Version 2.0.0 setOnSlideClickListener() not working? HOT 1
- Slider is not working with CollapsingToolbarLayout HOT 2
- Why selected drawable not circle but like diamond HOT 1
- Very silly library
- How to make slide zoomable?
- Problem with proguard HOT 1
- if interval expierd and banner not reciveiver from server crash the application
- images are messed
- ArrayIndexOutOfBoundsException after update items HOT 2
- slider image not changing after interval & indicators are also missing
- Slider does not auto slide inside CardView
- Migrate publishing to a new Repository
- How to Add OnClick
- How to Go 10th slide without Side Animation ( AnimateLayoutChanges ="false" not working!) HOT 1
- میشه فایل های صدا و ویدیو هم به جز عکس اضافه کرد یا نه؟؟ HOT 1
- how to video and voice add in slider ??
- Slider onClick HOT 4
- auto change image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from banner-slider.