Bool values

A bool is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine bool resources with other simple resources in the one XML file, under one <resources> element.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <bool
        name="bool_name"
        >[true | false]</bool>
</resources>
// load value in activity (kotlin code)
val screenIsSmall: Boolean = resources.getBoolean(R.bool.screen_small)

You can use bool values to detect some properties of device. Let we want to know, is device has a small screen.

1. Define screen_small value in the res/values/values.xml file.

<!-- Default boolean values -->
<resources>
    <bool name="screen_small">false</bool>
    <!-- ... -->
</resources>

2. Define screen_small value in the res/values-small/values.xml file.

<!-- small screen boolean values -->
<resources>
    <bool name="screen_small">true</bool>
</resources>