How to set textview as method output in andrioid?

前端 未结 2 411
忘掉有多难
忘掉有多难 2021-01-20 07:19

I have just started to use android studio recently and currently I am working on a Roman Numeral Translator app. The app\'s interface looks like this: Application interface<

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-20 07:43

    Make your translator() method return a string which contains the final output.

    So before the while statement in that method, declare a string such as String result = null; and in the loop append the popped values to this variable like, result += stack.pop().

    Now, the place where you call the translator(integer) method, do numeralInput.setText(translator(integer)) instead of translator(integer)

提交回复
热议问题