Increase a char value by one

前端 未结 6 2148
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-18 17:24

I have an app with an EditText and a button named \"forward\". All I want is just when I type \"a\" in the EditText and click the button, the word \"b\

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-18 18:01

    String value = edt.getText();
    edt.setText(value + 1);
    

    If the above is your code, then what you are doing is concatenating a 1 to the end of your value string. Thus, a button click would alter the displayed text from "your text" to "your text1". This process would continue on the next button click to show "your text11". The issue is really a type error.

提交回复
热议问题