Problem: How to create EditText programatically?
Solution:
[sourecode language=”java”] EditText ed = new EditText(this);// Type of input that you want from user to input i.e. number, text
ed.setInputType(InputType.TYPE_CLASS_TEXT);
// set the width/height of edittext
ed.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
// text color
ed.setTextColor(Color.MAGENTA);
// text to view initially inside the edit text
ed.setText(“Hello this is the edittext demo”);
[/sourecode]