Add multiple custom views to layout programmatically
You can inflate the layout2.xml file, edit the texts, and add it to the first layout: public class MyActivity extends Activity { private ViewGroup mLinearLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout1); mLinearLayout = (ViewGroup) findViewById(R.id.linear_layout); addLayout(“This is text 1”, “This is first button”, “This is second Button”); } private void addLayout(String textViewText, String … Read more