Explanation and solution at the bottom.
I am developing one slider layout animation, the animation work fine but when all processes end, they get next E
Above error due to passing wrong casting params :- because some time you set programattically parameter for linear layout but when you doing getLayoutParams() then it some time gives parent layout reference then it is gives above error .
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) parentLayout.getLayoutParams();
int leftMargin = (int) getResources().getDimension(R.dimen.exclusion_card_margin_left_right);
int rightMargin = (int) getResources().getDimension(R.dimen.exclusion_card_margin_left_right);
params.setMargins(leftMargin, 0, rightMargin, 0);
parentLayout.setLayoutParams(params);