core-ktx / androidx.content.res / android.content.res.TypedArray

Extensions for android.content.res.TypedArray

getBooleanOrThrow

fun TypedArray.getBooleanOrThrow(index: Int): Boolean

Retrieve the boolean value for the attribute at index or throws IllegalArgumentException if not defined.

getColorOrThrow

fun TypedArray.getColorOrThrow(index: Int): Int

Retrieve the color value for the attribute at index or throws IllegalArgumentException if not defined.

getColorStateListOrThrow

fun TypedArray.getColorStateListOrThrow(index: Int): ColorStateList

Retrieve the color state list value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionOrThrow

fun TypedArray.getDimensionOrThrow(index: Int): Float

Retrieve the dimension value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionPixelOffsetOrThrow

fun TypedArray.getDimensionPixelOffsetOrThrow(index: Int): Int

Retrieve the dimension pixel offset value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionPixelSizeOrThrow

fun TypedArray.getDimensionPixelSizeOrThrow(index: Int): Int

Retrieve the dimension pixel size value for the attribute at index or throws IllegalArgumentException if not defined.

getDrawableOrThrow

fun TypedArray.getDrawableOrThrow(index: Int): Drawable

Retrieve the drawable value for the attribute at index or throws IllegalArgumentException if not defined.

getFloatOrThrow

fun TypedArray.getFloatOrThrow(index: Int): Float

Retrieve the float value for the attribute at index or throws IllegalArgumentException if not defined.

getFontOrThrow

fun TypedArray.getFontOrThrow(index: Int): Typeface

Retrieve the font value for the attribute at index or throws IllegalArgumentException if not defined.

getIntOrThrow

fun TypedArray.getIntOrThrow(index: Int): Int

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

getIntegerOrThrow

fun TypedArray.getIntegerOrThrow(index: Int): Int

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

getResourceIdOrThrow

fun TypedArray.getResourceIdOrThrow(index: Int): Int

Retrieves the resource identifier for the attribute at index or throws IllegalArgumentException if not defined.

getStringOrThrow

fun TypedArray.getStringOrThrow(index: Int): String

Retrieve the string value for the attribute at index or throws IllegalArgumentException if not defined.

getTextArrayOrThrow

fun TypedArray.getTextArrayOrThrow(index: Int): Array<CharSequence>

Retrieve the text array value for the attribute at index or throws IllegalArgumentException if not defined.

getTextOrThrow

fun TypedArray.getTextOrThrow(index: Int): CharSequence

Retrieve the text value for the attribute at index or throws IllegalArgumentException if not defined.

use

fun <R> TypedArray.use(block: (TypedArray) -> R): R

Executes the given block function on this TypedArray and then recycles it.