I display a BitmapFont on the screen, update its text and the font is updated dynamically on the screen as well.
I seem to fail to do the same with a scene2d Label added as actor to a Stage.
The act(delta) and draw() methods are being called in the render() method.
My code basically looks as follows:

public void init() {
    Label label = new Label(text, labelStyle);

public void update() {

public void resize(int width, int height) {
    /* do some resizing */
    label.setPosition(newPositionX, newPositionY);

public void render(float delta) {
    /* do some rendering */

Do I need to do anything other than setting the Label text, adding it to the Stage as actor, and then updating the text elsewhere? The label displays its original text, though the text updating works fine.



2 Answers 2


You can call .setText("Some String"); on your label in your Render-method.

  • 1
    \$\begingroup\$ Am I missing something obvious here? Why is this downvoted as it seems like the most logical way do what's needed? \$\endgroup\$
    – ollipekka
    Sep 18, 2014 at 19:04
  • 1
    \$\begingroup\$ maybe because you probably dont want to do it in your render method since its a one off trigger operation. \$\endgroup\$
    – RichieHH
    Jul 14, 2015 at 11:56

I have decided to answer my own question to provide the solution I have come up with, in case someone may find it useful:

I have extended the Label class and overridden the act(float delta) method of the new custom label:

public class CustomLabel extends com.badlogic.gdx.scenes.scene2d.ui.Label {
    private String text;

    public CustomLabel(final CharSequence text, final LabelStyle style) {
        super(text, style);
        this.text = text.toString();

    public void act(final float delta) {

    public void updateText(final String text) {
        this.text = text;

The updateText(String text) method is then called from outside whenever the text of the label should be updated.

  • 4
    \$\begingroup\$ the updateText(String text) is redundant to setText(String text). \$\endgroup\$
    – digitebs
    Aug 8, 2014 at 2:45
  • 9
    \$\begingroup\$ Agree, drop your custom class and use label.setText directly. \$\endgroup\$ Sep 18, 2014 at 14:56
  • \$\begingroup\$ Another way this can be completed is submitting a task using Timer() . Those task are executed in the main loop. \$\endgroup\$ Jul 7, 2020 at 18:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .