Question: I have game level data hardcoded in onCreate method of Activity Class, but b I want to access them from other classes to. The data itself doesn't change.
Where should I keep the data, what is the most efficient way?

```
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_game)
    val words=arrayOf("aris","arsi","ris","risa","asi","sari")
    val wordstwo=arrayOf("mzeo","ezo","ezom","zemo","mze")//me
    val wordsthree=arrayOf("misni","is","minis","simi","mis","misi")
    val wordsfour=arrayOf("Tqveni","vqeniT","iqnevT","Tve","qve","vqeni")//"tqven"
    val challege:Array<Array<String>> = arrayOf(words,wordstwo,wordsthree,wordsfour)
    startGame(challege)
}

```

Answer: 
For data that does not change I suggest you use a [`TypedArray`-Resource](https://developer.android.com/guide/topics/resources/string-resource#StringArray)

XML file saved at res/values/arrays.xml:

```
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="words">
        <item>"aris"</item>
        <item>"arsi"/item>
        <item>"ris"</item>
        //... other items
    </string-array>
    //... other arrays
</resources>

```

Then in code:

```
val array: Array = resources.getStringArray(R.array.words)

```

This way you have a clean separation between code and data and can not accidentally change it.
You can have a static class DataHandler that has the data and access it from this class in all activities.

Update(2022):
Don't use static classes :)
You can just use a file.