How big can strings.xml resources be?












6















I saw this post that says when strings.xml gets too big the app can crash. My strings.xml file is 700 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 this.



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?










share|improve this question

























  • What did your logcat says

    – Killer
    Dec 23 '18 at 10:32











  • as i said there is no a crash right now, but the post that i linked says if the strings.xml is to big the app will be crash. My strings.xml will be to big in a while, my question is how big can strings.xml can be ?

    – Thelouras
    Dec 23 '18 at 10:35








  • 1





    Why can't you use SQLite directly? Meaning one table for each language? Just choose the language table you need and use the strings stored inside that one.

    – Fantômas
    Dec 23 '18 at 14:29











  • @Fantômas because the app was designed from the beginning like this and we are using locale with strings resources. And it wants a lot of work to transfer all the data from strings.xml in new tables. Maybe it will be done in a future refactoring!

    – Thelouras
    Dec 23 '18 at 15:19


















6















I saw this post that says when strings.xml gets too big the app can crash. My strings.xml file is 700 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 this.



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?










share|improve this question

























  • What did your logcat says

    – Killer
    Dec 23 '18 at 10:32











  • as i said there is no a crash right now, but the post that i linked says if the strings.xml is to big the app will be crash. My strings.xml will be to big in a while, my question is how big can strings.xml can be ?

    – Thelouras
    Dec 23 '18 at 10:35








  • 1





    Why can't you use SQLite directly? Meaning one table for each language? Just choose the language table you need and use the strings stored inside that one.

    – Fantômas
    Dec 23 '18 at 14:29











  • @Fantômas because the app was designed from the beginning like this and we are using locale with strings resources. And it wants a lot of work to transfer all the data from strings.xml in new tables. Maybe it will be done in a future refactoring!

    – Thelouras
    Dec 23 '18 at 15:19
















6












6








6








I saw this post that says when strings.xml gets too big the app can crash. My strings.xml file is 700 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 this.



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?










share|improve this question
















I saw this post that says when strings.xml gets too big the app can crash. My strings.xml file is 700 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 this.



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?







android android-resources






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 23 '18 at 21:04









Boann

36.9k1290121




36.9k1290121










asked Dec 23 '18 at 10:29









ThelourasThelouras

5031719




5031719













  • What did your logcat says

    – Killer
    Dec 23 '18 at 10:32











  • as i said there is no a crash right now, but the post that i linked says if the strings.xml is to big the app will be crash. My strings.xml will be to big in a while, my question is how big can strings.xml can be ?

    – Thelouras
    Dec 23 '18 at 10:35








  • 1





    Why can't you use SQLite directly? Meaning one table for each language? Just choose the language table you need and use the strings stored inside that one.

    – Fantômas
    Dec 23 '18 at 14:29











  • @Fantômas because the app was designed from the beginning like this and we are using locale with strings resources. And it wants a lot of work to transfer all the data from strings.xml in new tables. Maybe it will be done in a future refactoring!

    – Thelouras
    Dec 23 '18 at 15:19





















  • What did your logcat says

    – Killer
    Dec 23 '18 at 10:32











  • as i said there is no a crash right now, but the post that i linked says if the strings.xml is to big the app will be crash. My strings.xml will be to big in a while, my question is how big can strings.xml can be ?

    – Thelouras
    Dec 23 '18 at 10:35








  • 1





    Why can't you use SQLite directly? Meaning one table for each language? Just choose the language table you need and use the strings stored inside that one.

    – Fantômas
    Dec 23 '18 at 14:29











  • @Fantômas because the app was designed from the beginning like this and we are using locale with strings resources. And it wants a lot of work to transfer all the data from strings.xml in new tables. Maybe it will be done in a future refactoring!

    – Thelouras
    Dec 23 '18 at 15:19



















What did your logcat says

– Killer
Dec 23 '18 at 10:32





What did your logcat says

– Killer
Dec 23 '18 at 10:32













as i said there is no a crash right now, but the post that i linked says if the strings.xml is to big the app will be crash. My strings.xml will be to big in a while, my question is how big can strings.xml can be ?

– Thelouras
Dec 23 '18 at 10:35







as i said there is no a crash right now, but the post that i linked says if the strings.xml is to big the app will be crash. My strings.xml will be to big in a while, my question is how big can strings.xml can be ?

– Thelouras
Dec 23 '18 at 10:35






1




1





Why can't you use SQLite directly? Meaning one table for each language? Just choose the language table you need and use the strings stored inside that one.

– Fantômas
Dec 23 '18 at 14:29





Why can't you use SQLite directly? Meaning one table for each language? Just choose the language table you need and use the strings stored inside that one.

– Fantômas
Dec 23 '18 at 14:29













@Fantômas because the app was designed from the beginning like this and we are using locale with strings resources. And it wants a lot of work to transfer all the data from strings.xml in new tables. Maybe it will be done in a future refactoring!

– Thelouras
Dec 23 '18 at 15:19







@Fantômas because the app was designed from the beginning like this and we are using locale with strings resources. And it wants a lot of work to transfer all the data from strings.xml in new tables. Maybe it will be done in a future refactoring!

– Thelouras
Dec 23 '18 at 15:19














2 Answers
2






active

oldest

votes


















1














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.






share|improve this answer































    1














    The Resources.get*** methods doesn't have any explicit limitation, so it depends on your device's memory size. And as I know the old version of Android has per process memory limitation.






    share|improve this answer
























    • So that is not about how big strings.xml is ? but about the Resources.get*** method ?

      – Thelouras
      Dec 23 '18 at 11:13











    • Beacause my strings.xml file will be 1000+ lines. It is not a problem ?

      – Thelouras
      Dec 23 '18 at 11:14








    • 1





      Because you read strings.xml with Resources' methods. 1000+ lines in an xml file is not extravagant. You just need to take care of the memory usage.

      – shingo
      Dec 23 '18 at 13:00











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53902842%2fhow-big-can-strings-xml-resources-be%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    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.






    share|improve this answer




























      1














      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.






      share|improve this answer


























        1












        1








        1







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 23 '18 at 11:20









        HansfritziHansfritzi

        825




        825

























            1














            The Resources.get*** methods doesn't have any explicit limitation, so it depends on your device's memory size. And as I know the old version of Android has per process memory limitation.






            share|improve this answer
























            • So that is not about how big strings.xml is ? but about the Resources.get*** method ?

              – Thelouras
              Dec 23 '18 at 11:13











            • Beacause my strings.xml file will be 1000+ lines. It is not a problem ?

              – Thelouras
              Dec 23 '18 at 11:14








            • 1





              Because you read strings.xml with Resources' methods. 1000+ lines in an xml file is not extravagant. You just need to take care of the memory usage.

              – shingo
              Dec 23 '18 at 13:00
















            1














            The Resources.get*** methods doesn't have any explicit limitation, so it depends on your device's memory size. And as I know the old version of Android has per process memory limitation.






            share|improve this answer
























            • So that is not about how big strings.xml is ? but about the Resources.get*** method ?

              – Thelouras
              Dec 23 '18 at 11:13











            • Beacause my strings.xml file will be 1000+ lines. It is not a problem ?

              – Thelouras
              Dec 23 '18 at 11:14








            • 1





              Because you read strings.xml with Resources' methods. 1000+ lines in an xml file is not extravagant. You just need to take care of the memory usage.

              – shingo
              Dec 23 '18 at 13:00














            1












            1








            1







            The Resources.get*** methods doesn't have any explicit limitation, so it depends on your device's memory size. And as I know the old version of Android has per process memory limitation.






            share|improve this answer













            The Resources.get*** methods doesn't have any explicit limitation, so it depends on your device's memory size. And as I know the old version of Android has per process memory limitation.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 23 '18 at 11:11









            shingoshingo

            1,8481518




            1,8481518













            • So that is not about how big strings.xml is ? but about the Resources.get*** method ?

              – Thelouras
              Dec 23 '18 at 11:13











            • Beacause my strings.xml file will be 1000+ lines. It is not a problem ?

              – Thelouras
              Dec 23 '18 at 11:14








            • 1





              Because you read strings.xml with Resources' methods. 1000+ lines in an xml file is not extravagant. You just need to take care of the memory usage.

              – shingo
              Dec 23 '18 at 13:00



















            • So that is not about how big strings.xml is ? but about the Resources.get*** method ?

              – Thelouras
              Dec 23 '18 at 11:13











            • Beacause my strings.xml file will be 1000+ lines. It is not a problem ?

              – Thelouras
              Dec 23 '18 at 11:14








            • 1





              Because you read strings.xml with Resources' methods. 1000+ lines in an xml file is not extravagant. You just need to take care of the memory usage.

              – shingo
              Dec 23 '18 at 13:00

















            So that is not about how big strings.xml is ? but about the Resources.get*** method ?

            – Thelouras
            Dec 23 '18 at 11:13





            So that is not about how big strings.xml is ? but about the Resources.get*** method ?

            – Thelouras
            Dec 23 '18 at 11:13













            Beacause my strings.xml file will be 1000+ lines. It is not a problem ?

            – Thelouras
            Dec 23 '18 at 11:14







            Beacause my strings.xml file will be 1000+ lines. It is not a problem ?

            – Thelouras
            Dec 23 '18 at 11:14






            1




            1





            Because you read strings.xml with Resources' methods. 1000+ lines in an xml file is not extravagant. You just need to take care of the memory usage.

            – shingo
            Dec 23 '18 at 13:00





            Because you read strings.xml with Resources' methods. 1000+ lines in an xml file is not extravagant. You just need to take care of the memory usage.

            – shingo
            Dec 23 '18 at 13:00


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53902842%2fhow-big-can-strings-xml-resources-be%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Bressuire

            Cabo Verde

            Gyllenstierna