I have two methods:
public View addNewLinearLayout(Context context) {
LinearLayout linearLayout = new LinearLayout(context);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
params.height = 120;
linearLayout.setLayoutParams(params);
linearLayout.setBackgroundColor(Color.RED);
linearLayout.setGravity(Gravity.TOP);
linearLayout.addView(buttonsGenerator(context));
return linearLayout;
}
public View buttonsGenerator(Context context){
ListView lst;
lst = new ListView(context);
Button button = new Button(context);
return lst;
}
In addNewLinearLayout I add layout to view. In buttonsGenerator I wnat to add some buttons to list and add this list with buttons in my layout from addNewLinearLayout. How I can create list of buttons and add them to linear using method buttonsGenerator?