OpenSooq / Pluto

Pluto is an Easy, lightweight and high performance slider view library for Android. You have the flexibility to customize it to any view since it based RecyclerView.
https://engineering.opensooq.com
109 stars 16 forks source link

how to add custom indicator ? #6

Closed risnawan closed 4 years ago

risnawan commented 5 years ago

Hi,

I follow the readme and example instructions to add a custom indicator, but there is an error like this below

Unable to start activity ComponentInfo{com.sterling.clstoeng/com.sterling.clstoeng.TestActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter indicator
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter indicator
        at com.opensooq.pluto.PlutoView.setCustomIndicator(PlutoView.kt)
tamtom commented 5 years ago

@risnawan can you please show me the code? it looks like you are trying to pass a null value to custom indicator

risnawan commented 5 years ago

Hi @tamtom , thank you in advance for making a helpful library. I follow from readme

pluto = findViewById(R.id.slider_view);
pluto.setCustomIndicator(findViewById(R.id.custom_indicator));

but error error: incompatible types: View cannot be converted to PlutoIndicator I don't know what steps I passed.

then I try and error like initialization PlutoIndicator

pluto = findViewById(R.id.slider_view);
PlutoIndicator plutoIndicator = new PlutoIndicator(this);
plutoIndicator = findViewById(R.id.custom_indicator);
pluto.setCustomIndicator(plutoIndicator);

but I'm still stuck

MohamedHamole7 commented 5 years ago

when i try to use custom_indicator i found this error kotlin.UninitializedPropertyAccessException: lateinit property helper has not been initialized at com.opensooq.pluto.PlutoView.setCustomIndicator(PlutoView.kt:155) can any one help me plaese?

tamtom commented 4 years ago

@risnawan make sure you have updated Android version and if cant try to cast the view to PlutoIndicator @MohamedHamole7 follow the example in the project it should work if not please past the stacktrace