Chetna
Chetna

Reputation: 165

how to clear the TextView when reverting back to the same activity?

I have a TextView that displays an error message in the login page of my activity. I do not know how to clear its value when i come back to this activity. i used editText.setText("") for an EditText field. but when i tried to use this for my TextView it showed a NullPointerException What could be used here ?

error = (TextView) findViewById(R.id.errorPopUp);

Upvotes: 0

Views: 688

Answers (2)

Yahya Arshad
Yahya Arshad

Reputation: 1626

You should check this Activity Life Cycle

Upvotes: 0

GAMA
GAMA

Reputation: 5996

in onResume() method:

@Override
protected void onResume()
{
  super.onResume();
  error.setText("");
}

Upvotes: 2

Related Questions