Context
Compat Color
This function retrieves a color from resources in a backward-compatible way.
Parameters:
resId
(the resource ID of the color).Process: Uses
ContextCompat.getColor
to get the color, ensuring compatibility with older versions of Android.Return: The color as an
Int
.
Example:
Compat Drawable
This function retrieves a drawable from resources in a backward-compatible way.
Parameters:
resId
(the resource ID of the drawable).Process: Uses
ContextCompat.getDrawable
to get the drawable, ensuring compatibility with older versions of Android.Return: The drawable as a
Drawable?
.
Example:
Dimen Size
This function retrieves a dimension from resources and converts it to pixels.
Parameters:
resId
(the resource ID of the dimension).Process: Uses
resources.getDimensionPixelSize
to get the dimension in pixels.Return: The dimension size in pixels as an
Int
.
Example:
Get Integer
This function retrieves an integer value from resources.
Parameters:
resId
(the resource ID of the integer).Process: Uses
resources.getInteger
to get the integer value.Return: The integer value as an
Int
.
Example:
Last updated