You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KyleTheHack3r edited this page Jun 20, 2015
·
1 revision
Strings
A string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. You can define a string in: /res/values/strings.xml.
This is what a string looks like: <string name="string_name">Bla Bla Bla</string>
Let's look into that a bit deeper. The string tag defines a string. name="" defines the string name. And between the closing tag is what will be stored in the string.
A String can be useful in many situations. Ie, if you need to display the app name multiple times, or if you need to display content that changes often. Another example is the app version. This will obviously change a lot, so you don't want to change every page per update. This is how the app version would look like: <string name="app_version">1.0.1</string>. To display this, you would have android:text="@string/app_version in a TextView.