7

There is a type Integer in the Android resources:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="bytes_size">2147483647</integer>
</resources>

The maximum value is then 2147483647, so how could I have a bigger value in there, like a long? Do I have to put it as a String and then transform it to a long, or is there a better way?

galex
  • 3,279
  • 2
  • 34
  • 46

1 Answers1

3

Not the ideal solution but you can store the value as a string and parse it during runtime.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="bytes_size">4294967296</string>
</resources>

Now you simply parse it into long.

String longString = getResources().getString(R.string.bytes_size);
long bytes_size = Long.parseLong(longString);
Shakti
  • 1,581
  • 2
  • 20
  • 33
  • 1
    Yeah that's exactly what I was trying to avoid to do. But as it's the only real solution for it, you are right. – galex Mar 04 '16 at 15:10