I am making a new textview with this code:
TextView score = new TextView (this);
score.setTag("scoreteller");
score.setHeight(25);
score.setWidth(30);
layout.addView(score);
Now my question is, how am I able to retrieve this textview later on, in a new method?
Not with the findViewById() method, because I don’t know it. If I add this sentence:
score.setId(9);
and then use findViewById(R.id.9) it gives an error: Syntax error on token “.9”, delete this token.
So how can I retrieve it to change it’s text?
You need to replace
findViewById(R.id.9)withfindViewById(9). You can also usefindViewByTag("scoreteller");