Array storage in xml file

I want to store an array in an XML file.

The array will be called with the following function.

String getTextSpeech = TextSpeech[Index];

This is the use of textToSpeechAPI.

How to save a TextSpeech [] array in an xml file in a values ​​folder, and then call it inside the class.

thank

Edit:

<resources>
<string-array name="myArray"> 
    <item>String1</item> 
    <item>String2</item> 
    <item>String3</item> 
</string-array> 
</resources>
+3
source share
2 answers

In action you can name it

String[] resourceString =getResources().getStringArray(R.array.myArray);

if your class is not an activity type then use a constructor of the class type

YourClass(Context activityContext)
{
     String[] resourceString =activityContext.getResources().getStringArray(R.array.myArray);
}
+1
source

You cannot store anything at valuesruntime, but what you want can be achieved using the various data storage solutions provided by android http://developer.android.com/guide/topics/data/data- storage.html

SQLite Databases

-1

All Articles