Git Product home page Git Product logo

Comments (9)

andisusilo avatar andisusilo commented on June 8, 2024 3

This library is Fragment based and it needed the Activity to use this.
The problem is if you use the slider view into CollapsingToolbarLayout, so the result from the getContext() this library is ContextThemeWrapper instead AppCompatActivity.

You can solve the problem by obtaining the parent AppCompatActivity from that ContextThemeWrapper.

Open ss/com/bannerslider/views/BannerSlider.java file on line 121.
And change it from:

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

to

if (getContext() instanceof AppCompatActivity) {
    hostActivity = (AppCompatActivity) getContext();
} else if(getContext() instanceof android.view.ContextThemeWrapper){
    hostActivity = (AppCompatActivity) ((ContextWrapper) getContext()).getBaseContext(); // this is to get the AppCompatActivity from the ContextThemeWrapper
} else {
    throw new RuntimeException("Host activity must extend AppCompatActivity");
}

After that you can use the slider into CollapsingToolbarLayout view.

from banner-slider.

saeedsh92 avatar saeedsh92 commented on June 8, 2024

Your activity that banner slider is on it, must extend AppCompatActivity

from banner-slider.

amitthorat avatar amitthorat commented on June 8, 2024

I have extended activity with AppCompatActivity still problem is not resolved

from banner-slider.

Morteza-Rastgoo avatar Morteza-Rastgoo commented on June 8, 2024

Can you please upload the full code?
I am working on a Design like that

from banner-slider.

erik7667 avatar erik7667 commented on June 8, 2024

این مشکل منم هست . میشه راهنمایی کنین که چطور میتونم حلش کنم ؟

from banner-slider.

ali-amani avatar ali-amani commented on June 8, 2024

@andisusilo tnx for your answer but could u tell me how change a jar file without open it ?

or how make it writable in android studio because files are read only .

from banner-slider.

andisusilo avatar andisusilo commented on June 8, 2024

@ali-amani add this library as source, merge with your source code (download and merge with your source code). Don't adding in gradle.

from banner-slider.

FahedHermoza avatar FahedHermoza commented on June 8, 2024

I have the same problem there is no better solution.

from banner-slider.

rizkidzulkarnain avatar rizkidzulkarnain commented on June 8, 2024

when I using toolbar layout, interval was not working
any solution ?

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.