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?
The Long class wraps a value of the primitive type long in an object. An object of type Long contains a single field whose type is long . In addition, this class provides several methods for converting a long to a String and a String to a long , as well as other constants and methods useful when dealing with a long .
The documentation for getResources() says that it will [r]eturn a Resources instance for your application's package. In code examples I've seen this used to access the resources in res , but it seems like you can just access them directly. For example to retrieve my_string from res/values/strings.
Resources are the additional files and static content that your code uses, such as bitmaps, layout definitions, user interface strings, animation instructions, and more. You should always externalize app resources such as images and strings from your code, so that you can maintain them independently.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With