LinearLayout dynamically display depending on a given number

I want to create a method that can dynamically display LinearLayout in a LinearLayout moreover that is located in a specified area in my Android application, the number of this linear layout changes depending on a given number.

Also, in each LinearLayout I want to display a Button & below it a TextView.

Here is the method I have already created:

you just need to set the layoutparams