24.6 Adding the EditText View
The next item to be added to the layout is the EditText view. The first step is to create the EditText object, assign it the ID as declared in the id.xml resource file and add it to the layout. The code changes to achieve these steps now need to be made to the configureLayout() method as follows:
private void configureLayout() {
Button myButton = new Button(this);
myButton.setText(getString(R.string.press_me));
myButton.setBackgroundColor(Color.YELLOW);
myButton.setId(R.id.myButton);
EditText myEditText = new EditText(this);
myEditText.setId(R.id.myEditText);
ConstraintLayout myLayout = new ConstraintLayout(this);
myLayout.setBackgroundColor(Color.BLUE);
myLayout.addView(myButton)...