I know this is a simple question, but I can't figure out how to reference strings in android. for example
on this EditText, I don't want to hardcode the string hi, I want it to reference a string in the res folder. How do I do this?
Figured it out. All you need to do is create a string in the res value folder and then reference it
Create a file strings.xml in res/values/ folder, and add a text in it like
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="mystring">MyStringFromXML</string>
</resources>
then reference the text in layout as :
android:text="@string/mystring"
And in Java file do it like:
String string = getString(R.string.mystring);