NullPointerException
NullPointerException

Reputation: 37577

Changing the text value of a textview dynamically

I have a textview in my XML layout file, but when I try to change its text value with code programatically (dynamically, depending on which button the user clicks) then the text of the textview doesn't change.

This is the code that I tried:

TextView userText = (TextView) findViewById(R.id.User);

userText.setText(bundle.getString("user"));

In debug mode, I can see that usertext has the changed text, but the change doesn't appear on my mobile window... I don't know why.

EDIT: SOLVED!!!! it was a problem with my relative layout, text is out of the window!!!

Upvotes: 2

Views: 9409

Answers (1)

Falmarri
Falmarri

Reputation: 48559

userText.invalidate()

Upvotes: 1

Related Questions