How to start an EditText as null?

1

I want, when the user marks a RadioButton , an EditText that has already been started as null, appears, but I do not know how to do this. >     

asked by anonymous 10.06.2015 / 21:46

2 answers

1

The visibility of a View can be indicated using the JAVA method setVisibility() or the XML android.visibility attribute.

In order for your EditText to initialize as invisible do:

In XML

<EditText
    android:id="@+id/minhaEditText"
    ....
    ....
    android:visibility="invisible"
    ..../>

Or JAVA
In method onCreate()

EditText minhaEditText = (EditText) findViewById(R.id.minhaEditText);
minhaEditText.setVisibility(View.INVISIBLE);  

When you want it to be visible again:

minhaEditText.setVisibility(View.VISIBLE);  
    
10.06.2015 / 23:15
0

Do you want EditText to be NULL or have no content written to it? If it is not content, just do something like this:

editText.setText("");

This will cause the EditText content to be left blank.

    
10.06.2015 / 23:05