jay
jay

Reputation: 7

how to read data in a textfield

I have a textfield but I don't know how to save the input. I'm using libgdx's scene2d.

txtUsername = new TextField("", mSkin);
     txtUsername.setMessageText("test");
     txtUsername.setPosition(30, 30);   
     mStage.addActor(txtUsername);

Upvotes: 0

Views: 179

Answers (1)

Angel Angel
Angel Angel

Reputation: 21658

to get the text you can use txfUsername.getText(); when you say save if you mean in a variable use String yourStringVariable = txfUsername.getText();I think that saving is basic :), look this similar code : Cannot show user input with a textfield I hope I understood your question

Upvotes: 1

Related Questions