You are here

java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams

I spent a few hours debugging this exception in an Android app. When you create a new View you usually set its LayoutParams. The trick is that you need you use the Type of LayoutParams that is from the parent view's class. So if you're adding a LinearLayout to a FrameLayout, you need to set LayoutParams to an instance of FrameLayout.LayoutParams.

Tags: 

Add new comment

Simple Copyright Policy: If you want to reproduce anything on this site, get my permission first.