String Array An array of strings that can be referenced from the application. Note: A string array is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine string array resources with other simple resources in the one XML file, under one <resources> element. file location:res/values/filename .xml No attributes. <string-array> Defines an array of strings. Contains one or more <item> elements. attributes: name String . A name for the array. This name will be used as the resource ID to reference the array.<item> A string, which can include styling tags. The value can be a referenced to another string resource. Must be a child of a <string-array> element. Beware that you must escape apostrophes and quotation marks. SeeFormatting and Styling , below, for information about to properly style and format your strings. No attributes. example:XML file saved at res/values/strings.xml : <? xml version = "1.0" encoding = "utf-8" ?> This application code retrieves a string array: Resources res = getResources () ;
|
|