You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my application I have a number of fragments, most of which contain a ListView, including one with an HListView. There are two paths to the fragment with the HListView - one works without issue, and the other throws a ClassCastException. I've spent several hours trying to figure out the cause, but I can't find an answer in my code. I am not importing either of these LayoutParams, and I've made sure the ids of the layouts and layout objects are unique. Below is the log which captures the exception. Any ideas?
FATAL EXCEPTION: main
java.lang.ClassCastException: android.widget.AbsListView$LayoutParams cannot be cast to it.sephiroth.android.library.widget.AbsHListView$LayoutParams
at it.sephiroth.android.library.widget.HListView.clearRecycledState(HListView.java:506)
at it.sephiroth.android.library.widget.HListView.resetList(HListView.java:493)
at it.sephiroth.android.library.widget.HListView.layoutChildren(HListView.java:1560)
at it.sephiroth.android.library.widget.AbsHListView.onLayout(AbsHListView.java:1676)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1879)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1700)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1005)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4243)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4777)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:998)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:765)
at dalvik.system.NativeStart.main(Native Method)
The text was updated successfully, but these errors were encountered:
Could you try inflating the footer with the listview passed in as the parent?
View footer = inflater.inflate(R.layout.footer_layout, mListView, false);
Also make sure you add footer before setting adapter on the listview
Thank you, I spent so much time finding the previous error that I forgot that headers and footers come before setting the adapter. Short lesson - make sure the headers/footers are set before the adapter, and make sure the inflater has the right parameters
In my application I have a number of fragments, most of which contain a ListView, including one with an HListView. There are two paths to the fragment with the HListView - one works without issue, and the other throws a ClassCastException. I've spent several hours trying to figure out the cause, but I can't find an answer in my code. I am not importing either of these LayoutParams, and I've made sure the ids of the layouts and layout objects are unique. Below is the log which captures the exception. Any ideas?
FATAL EXCEPTION: main
java.lang.ClassCastException: android.widget.AbsListView$LayoutParams cannot be cast to it.sephiroth.android.library.widget.AbsHListView$LayoutParams
at it.sephiroth.android.library.widget.HListView.clearRecycledState(HListView.java:506)
at it.sephiroth.android.library.widget.HListView.resetList(HListView.java:493)
at it.sephiroth.android.library.widget.HListView.layoutChildren(HListView.java:1560)
at it.sephiroth.android.library.widget.AbsHListView.onLayout(AbsHListView.java:1676)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14016)
at android.view.ViewGroup.layout(ViewGroup.java:4647)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1879)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1700)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1005)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4243)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4777)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:998)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:765)
at dalvik.system.NativeStart.main(Native Method)
The text was updated successfully, but these errors were encountered: