Example usage for android.content.res Resources getColorStateList

List of usage examples for android.content.res Resources getColorStateList

Introduction

In this page you can find the example usage for android.content.res Resources getColorStateList.

Prototype

@NonNull
public ColorStateList getColorStateList(@ColorRes int id, @Nullable Theme theme) throws NotFoundException 

Source Link

Document

Returns a themed color state list associated with a particular resource ID.

Usage

From source file:Main.java

/**
 * @see android.content.res.Resources#getColorStateList(int id).
 *///from www .j a v a  2  s  .  co m
@SuppressWarnings("deprecation")
public static ColorStateList getColorStateList(Resources res, int id) throws NotFoundException {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        return res.getColorStateList(id, null);
    } else {
        return res.getColorStateList(id);
    }
}