Search code examples
androidandroid-resources

How big can strings.xml resources be?


I saw this post that says when strings.xml gets too big the app may crash. My strings.xml file is 800 plus lines right now and it will be a lot bigger in a while.

The answers in the post say that using a SQLite database can prevent the crash.

But in my case I have a SQLite database that takes the data for the entries from strings.xml because my app uses locales for different languages.

My question is, how big can strings.xml be? And if I hit the line limit what can I do to prevent the crash?


Solution

  • There is no limitation of the strings.xml. Its more a problem of loading a string array. The getResources().getStringArray function is not meant to load arrays with more elements than 512 (more about this here Should I be using something other than getResource().getStringArray() to populate a large array?) But as long as you are not using big arrays you should be fine.