I have a TextView that starts at '0' and is updated on button press to reflect the current score total, public int points
. The TextView does update, but one or more of the characters in the score are truncated (for instance, "1580" might display as "158" or "15"). When the activity is completed and sent to the scoreboard activity, however, the points shown are correct (the variable passed on intent is the same variable points
).
Here is my relevant Java code:
public int points = 0;
TextView currentScoreCounter = (TextView) findViewById(R.id.scoreCounter);
currentScoreCounter.setText(String.valueOf(points));
And here is the scoreCounter
in my XML file:
<TextView
android:id="@+id/scoreCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="30dp"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true" />
I suspect it may have something to do with the width/height of the TextView, but I am unsure.