How to save an array of string in Android?

Hi guys,

I’m working on an Android project, how do I save an array of strings in Android ? and there is a limit to the amount of string that I can add to the array (I need to add a lot of them).

thank you,
Diego.

I think that you are talking about PlayerPrefs.

You must serialize your array into a simple string, you can use json, join/split, xml, etc.

I think that have no limitation about amount of data that you save in it, only normal limitations like memory and disk space. But, it is not designed to use like this.

I recommend to directly use filesystem. Something like:

import System.IO;

var path = Application.persistentDataPath + "/data";

using (StreamWriter w = new StreamWriter(path)) {
  w.WriteLine("hi");
}

using (StreamReader r = new StreamReader(path)) {
  var line = r.ReadLine();
}