Updating variables in addcontentview - android

782 views Asked by At

I have been developing a game with opengles for android and have a glsurfaceview displayed. I also have a textview displayed over this by using

addContentView(mytextview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT) );

mytextview contains a string which is made up of a string plus the parsed value of an int. eg something like

 mytextview = new TextView(this);
 mytextview.setText("Score: " + Integer.toString(score) );

The textview and the integer value display but My question is how do I update this when the integer value changes?

1

There are 1 answers

2
zrgiu On BEST ANSWER

you'll have to call mytextview.setText("Score: " + Integer.toString(score) ); every time the score changes.