I am playing a bit around with Android after doing a number of tutorials.
I have a textview in which I want to print various lines of text that I have written in the strings.xml file:
<string name="welcome">Welcome! What is your name?</string>
<string name="welcome2">Welcome!</string>
In my main I have:
gamehistory = (TextView)findViewById(R.id.textView2);
gamehistory.setText(R.string.welcome);
This works fine and it displays the text. I want to use the textbox as a "log" so that a bit later in my code it prints welcome2 in the next line.
gamehistory.append("\n" + R.string.welcome2);
Unfortunately, when I use append, it turns the string into a number.
Is there a way to avoid this?
To append i think will not be there but yes you can concatenate like this
String outStr = getString(R.string.first) +
" " + getString(R.string.second);
For Refrence Link to refrence