开发者

Save state of String within EditText and clear string within same button

I was wandering if there is anyway to save a String from an EditText and clear it within the same onClick button.

The reason is I am creating a jumble 开发者_JAVA百科word game where 1 player can jumble a word and then clear the word so the 2nd player cannot see it. The reason why I want to save the String is so I can match it with what player 2 enters.

Any advise would be helpful. Thanks


Place the following fragments of code in your onClick:

// Save
String text = someEditText.getText();
// Clear:
someEditText.setText("");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜