How to set programtically height and width to framelayout in android : I want to set height and width for framelayout but if give using setlayoutparams am facing this issue:

This is my java code

        
     FrameLayout frameLayout2= (FrameLayout) light.findViewById(R.id.frameLayout2);
     LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(300, 150);
     frameLayout2.setLayoutParams(lp);

*this is my xml:*
Note:Constraint layout is my parent


    <android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".LightPlaceFragment"
        tools:layout_editor_absoluteY="81dp"
        tools:layout_editor_absoluteX="0dp"
        android:background="@color/colorAccent">
    
    
    
        <FrameLayout
            android:layout_width="300dp"
            android:layout_height="300dp"
            android:layout_marginRight="8dp"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            android:layout_marginBottom="8dp"
            android:layout_marginLeft="8dp"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintHorizontal_bias="0.882"
            android:layout_marginTop="8dp"
            app:layout_constraintTop_toBottomOf="@+id/l_width"
            app:layout_constraintVertical_bias="0.162"
            android:id="@+id/frameLayout2">
    
    
            <include
                android:id="@+id/other"
                android:layout_width="300dp"
                android:layout_height="200dp"
                android:visibility="visible"
                layout="@layout/sample1" />
           
        </FrameLayout>
    
    
    
    </android.support.constraint.ConstraintLayout>

*This is issue:*
**        java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.constraint.ConstraintLayout$LayoutParams**

Please kindly help me.Because each time i want to change the framelayout width and height ,how to give please help me.