java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams

Stack Overflow | Sapna Sharma | 1 month ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael and poroszd . Or join the community to write better ones.
  1. 0

    Trying to set top margin of linear layout programatically

    Stack Overflow | 1 month ago | Sapna Sharma
    java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams
  2. 0
    samebug tip
    This issue was solved in 2.2.6. If updating doesn't solve, try using notifyItemRangeChanged(1, mDatas.size()) instead of notifyItemRangeChanged(0, mDatas.size()).
  3. 0
    samebug tip
    Also, you should dispatch events as soon as they happen, ReciclerView already bundles all updates.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    If you're using notifyItemChanged(position) try changing it for notifyDataSetChanged().
  6. 0
    samebug tip
    You have to provide valid identical number for each child items.
    via GitHub by h6ah4i
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.ClassCastException

    android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams

    at android.widget.FrameLayout.onMeasure()
  2. Android Platform
    FrameLayout.onMeasure
    1. android.widget.FrameLayout.onMeasure(FrameLayout.java:437)
    1 frame
  3. Android Support v4
    NestedScrollView.onMeasure
    1. android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:482)
    1 frame
  4. Android Platform
    View.measure
    1. android.view.View.measure(View.java:17555)
    2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
    3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    4. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    5. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    6. android.view.View.measure(View.java:17555)
    6 frames
  5. se.emilsjolander.flipview
    FlipView.onMeasure
    1. se.emilsjolander.flipview.FlipView.measureChild(FlipView.java:252)
    2. se.emilsjolander.flipview.FlipView.measureChildren(FlipView.java:245)
    3. se.emilsjolander.flipview.FlipView.onMeasure(FlipView.java:228)
    3 frames
  6. Android Platform
    FrameLayout.onMeasure
    1. android.view.View.measure(View.java:17555)
    2. android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728)
    3. android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464)
    4. android.view.View.measure(View.java:17555)
    5. android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728)
    6. android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464)
    7. android.view.View.measure(View.java:17555)
    8. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
    9. android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
    9 frames
  7. Android v7
    ContentFrameLayout.onMeasure
    1. android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
    1 frame
  8. Android Platform
    FrameLayout.onMeasure
    1. android.view.View.measure(View.java:17555)
    2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
    3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    4. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    5. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    6. android.view.View.measure(View.java:17555)
    7. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
    8. android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
    9. android.view.View.measure(View.java:17555)
    10. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
    11. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    12. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    13. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    14. android.view.View.measure(View.java:17555)
    15. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5536)
    16. android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
    16 frames
  9. Android
    PhoneWindow$DecorView.onMeasure
    1. com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2615)
    1 frame
  10. Android Platform
    ActivityThread.main
    1. android.view.View.measure(View.java:17555)
    2. android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2027)
    3. android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1185)
    4. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1391)
    5. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1073)
    6. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5903)
    7. android.view.Choreographer$CallbackRecord.run(Choreographer.java:773)
    8. android.view.Choreographer.doCallbacks(Choreographer.java:586)
    9. android.view.Choreographer.doFrame(Choreographer.java:556)
    10. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:759)
    11. android.os.Handler.handleCallback(Handler.java:739)
    12. android.os.Handler.dispatchMessage(Handler.java:95)
    13. android.os.Looper.loop(Looper.java:135)
    14. android.app.ActivityThread.main(ActivityThread.java:5268)
    14 frames
  11. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:372)
    2 frames
  12. Android
    ZygoteInit$MethodAndArgsCaller.run
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
    1 frame