How to start an Edittext as null?

Asked

Viewed 239 times

1

I want that when the user marks a Radiobutton, one Edittext that has already been started as null, appear, but I do not know how to do it.

  • 1

    That one Edittext is declared in an XML or is it created by code? Explain what you mean by "Edittext that has already been started as null"

  • This Edtitext has already been set up in an XML file, it has already been called in JAVA, and now I wanted to make this Edittext start as null and, when the user clicks on a Radiobutton, it appears

  • You want to make Edittext who is invisible for visible?

  • Almost that... I want that when opening the xml file as Activity, it already starts Invisible, but, when I mark the radiobutton, it appears

2 answers

1

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

So that your Edittext boot as invisible do:

In the XML

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

Or in the JAVA
In the method onCreate()

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

When you want her to be visible again:

minhaEditText.setVisibility(View.VISIBLE);  

0

Do you want Edittext to be NULL or without written content in it? If it’s without content just do something like:

editText.setText("");

This will make Edittext content blank.

  • I want it to start null already, so that when I mark a radiobutton, it becomes visible

Browser other questions tagged

You are not signed in. Login or sign up in order to post.