How big can strings.xml resources be?
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
add a comment |
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
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
add a comment |
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
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
android android-resources
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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.
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Dec 23 '18 at 11:20
HansfritziHansfritzi
825
825
add a comment |
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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