1) the application always crashes with an error rate. It is very, very, very bad to ask for help without making any effort to solve the problem. If the problem is in error, no one will guess what the error has arisen.
2) Yes, I still guess. FrameLayout itself is not in FrameLayout 'e, right? That's depending on what it is, and you need to pass a certain type of LayoutParams to setLayoutParams . So, if it is in LinearLayout , then you need to call it like this:
frameLayout.setLayoutParams(new LinearLayout.LayoutParams(50,70));
for RelativeLayout :
frameLayout.setLayoutParams(new RelativeLayout.LayoutParams(50,70));