How to Output Variables to XML Strings on Android
Android uses output variables in a string resource file formatted in the XML language. Android development uses XML as a data source to store variables, parameters and layout screens. Each output string is given a name, and you use that name to output the value to your Android users. Every Android app has a main resource XML file where you store your variables and the values.
Instructions
-
-
1
Launch the Android Eclipse software on your desktop. Open the Android Java app in the Eclipse environment.
-
2
Double-click the "Resource" directory in the left panel that lists all of your app's files. Double-click the XML file in the directory to open the XML code.
-
-
3
Add your output string variable. Add each variable within the "Resources" tag. For instance, the following code creates a "Hello World" string for the app:
<string name="myvar">My output string</string>
Give your string any name. The name of the variable is stored in the "name" property. The value you want to display is typed within the string's definition. In this example, "My output string" is the value of the "myvar" variable.
-
1