getBoolean

fun getBoolean(key: String?, defValue: Boolean): Boolean

Retrieves a boolean value from the shared preferences.

Return

The preference value if it exists, otherwise defValue.

Parameters

key

The name of the preference to retrieve.

defValue

Value to return if the preference does not exist.

Throws

If there is a preference with this name that is not a boolean.