JonathanPark JonathanPark - 1 year ago 93
Android Question

Creating textfields after hitting a button (Eclipse/Android)

I am trying to learn android development in Eclipse and I am stuck. I created a button with using this.


And my listener is the following.

button1=(Button) findViewById(;
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {


What I want is the following. When I click my button I want 3 different textfields to be seen. After I enter some values to that textfields, I want to get back to the initial screen which contains button1. How can I do that? Also with which method I can store the values that are written to this textfields?

Edit:All answers were helpful and I upvoted them but I accepted Diego's answer because of the clarity

Answer Source

If you want the EditText appear after you click a Button you can include all of them in the same XML layout file, set the EditText to INVISIBLE (android:visibility="invisible") and change it to VISIBLE in the OnClick listener.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download