smhdk/KM-Popup-Image-Slider

AndroidX Error

Closed this issue · 2 comments

Here is my usage

  val dialog = PopopDialogBuilder(it)
                                    .setList(list)
                                    .setHeaderBackgroundColor(android.R.color.holo_blue_light)
                                    .setDialogBackgroundColor(R.color.color_dialog_bg)
                                    .showThumbSlider(true)
                                    .build()
                            dialog.show()

Here is the error.

java.lang.ClassCastException: androidx.appcompat.widget.AppCompatImageView cannot be cast to com.kodmap.app.library.ui.KmRelativeLayout
        at com.kodmap.app.library.adapter.PopupThumbAdapter.onCreateViewHolder(PopupThumbAdapter.kt:39)
        at com.kodmap.app.library.adapter.PopupThumbAdapter.onCreateViewHolder(PopupThumbAdapter.kt:25)
        at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
        at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
        at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
        at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
        at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
        at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
        at android.view.View.measure(View.java:22075)
        at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
        at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
        at android.view.View.measure(View.java:22075)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:22075)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
        at android.view.View.measure(View.java:22075)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at com.android.internal.policy.DecorView.onMeasure(DecorView.java:724)
        at android.view.View.measure(View.java:22075)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2426)
        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1508)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1765)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1396)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6773)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
        at android.view.Choreographer.doCallbacks(Choreographer.java:778)
        at android.view.Choreographer.doFrame(Choreographer.java:713)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6518)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

smhdk commented

Hi @msayan ,
This issue may be due to non-unique layout name.You can rename your item_thumb.xml.

Thank you @smhdk !