Example usage for android.support.v4.content.res TypedArrayUtils getDrawable

List of usage examples for android.support.v4.content.res TypedArrayUtils getDrawable

Introduction

In this page you can find the example usage for android.support.v4.content.res TypedArrayUtils getDrawable.

Prototype

public static Drawable getDrawable(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex) 

Source Link

Usage

From source file:android.support.v7.preference.DialogPreference.java

public DialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DialogPreference, defStyleAttr,
            defStyleRes);//from  www  . j a  v a2s  .co  m

    mDialogTitle = TypedArrayUtils.getString(a, R.styleable.DialogPreference_dialogTitle,
            R.styleable.DialogPreference_android_dialogTitle);
    if (mDialogTitle == null) {
        // Fall back on the regular title of the preference
        // (the one that is seen in the list)
        mDialogTitle = getTitle();
    }

    mDialogMessage = TypedArrayUtils.getString(a, R.styleable.DialogPreference_dialogMessage,
            R.styleable.DialogPreference_android_dialogMessage);

    mDialogIcon = TypedArrayUtils.getDrawable(a, R.styleable.DialogPreference_dialogIcon,
            R.styleable.DialogPreference_android_dialogIcon);

    mPositiveButtonText = TypedArrayUtils.getString(a, R.styleable.DialogPreference_positiveButtonText,
            R.styleable.DialogPreference_android_positiveButtonText);

    mNegativeButtonText = TypedArrayUtils.getString(a, R.styleable.DialogPreference_negativeButtonText,
            R.styleable.DialogPreference_android_negativeButtonText);

    mDialogLayoutResId = TypedArrayUtils.getResourceId(a, R.styleable.DialogPreference_dialogLayout,
            R.styleable.DialogPreference_android_dialogLayout, 0);

    a.recycle();
}