TypedArray getIndex - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TypedArray getIndex method.

This code example shows how to use the following methods:getBoolean, getIndex, getResourceId, recycle
        mContext=context;
        mVisibilityController = new VisibilityController(this);
        TypedArray a = context.obtainStyledAttributes(attrs, new int[] {
        		android.R.attr.windowTitleStyle,
                android.R.attr.defaultValue });
        mIsLegacy = a.getBoolean(a.getIndex(1 /* defaultValue */), false);
        if (mIsLegacy) {
            mTitleResource = a.getResourceId(a.getIndex(0 /* windowTitleStyle */), 0);
        } else { 
            a.recycle();
            a = context.obtainStyledAttributes(null,
                    new int[] { android.R.attr.titleTextStyle,
                            android.R.attr.subtitleTextStyle },
                    android.R.attr.actionBarStyle,
                    0); 
            mTitleResource = a.getResourceId(a.getIndex(0 /* titleTextStyle */), 0);
            mSubtitleResource = a.getResourceId(a.getIndex(1 /* subtitleTextStyle */), 0);
        } 
        a.recycle();
    } 

8
CodeRank
This code example shows how to use the following methods:getBoolean, getIndex, getResourceId, recycle
        mContext=context;
        mVisibilityController = new VisibilityController(this);
        TypedArray a = context.obtainStyledAttributes(attrs, new int[] {
        		android.R.attr.windowTitleStyle,
                android.R.attr.defaultValue });
        mIsLegacy = a.getBoolean(a.getIndex(1 /* defaultValue */), false);
        if (mIsLegacy) {
            mTitleResource = a.getResourceId(a.getIndex(0 /* windowTitleStyle */), 0);
        } else { 
            a.recycle();
            a = context.obtainStyledAttributes(null,
                    new int[] { android.R.attr.titleTextStyle,
                            android.R.attr.subtitleTextStyle },
                    android.R.attr.actionBarStyle,
                    0); 
            mTitleResource = a.getResourceId(a.getIndex(0 /* titleTextStyle */), 0);
            mSubtitleResource = a.getResourceId(a.getIndex(1 /* subtitleTextStyle */), 0);
        } 
        a.recycle();
    } 

8
CodeRank
This code example shows how to use the following methods:getIndex, getResourceId, recycle
This code example shows how to use the following methods:getIndex, getResourceId, recycle
This code example shows how to use the following methods:getDrawable, getIndex, recycle
		return getSystemAttrColor(context, SELECTOR_BACKGROUND_COLOR);
	} 
	 
	public static Drawable getSystemAttrDrawable(Context context, int attr) {
		TypedArray a = context.obtainStyledAttributes(new int[] { attr });
		Drawable d = a.getDrawable(a.getIndex(0));
		a.recycle();
		return d;
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getBoolean, getIndex, getResourceId, recycle
		super(context, attrs, 0);
		mContext = context;
		mVisibilityController = new VisibilityController(this);
		TypedArray a = context.obtainStyledAttributes(attrs, new int[] { android.R.attr.windowTitleStyle,
				android.R.attr.defaultValue });
		mIsLegacy = a.getBoolean(a.getIndex(1 /* defaultValue */), false);
		if (mIsLegacy) {
			mTitleResource = a.getResourceId(a.getIndex(0 /* windowTitleStyle */), 0);
		} else { 
			a.recycle();
			a = context.obtainStyledAttributes(null, new int[] { android.R.attr.titleTextStyle,
					android.R.attr.subtitleTextStyle }, android.R.attr.actionBarStyle, 0);
			mTitleResource = a.getResourceId(a.getIndex(0 /* titleTextStyle */), 0);
			mSubtitleResource = a.getResourceId(a.getIndex(1 /* subtitleTextStyle */), 0);
		} 
		a.recycle();
	} 
	 
	@Override 
	protected void onFinishInflate() { 
		super.onFinishInflate(); 
6
CodeRank
This code example shows how to use the following methods:getDrawable, getIndex, recycle
		return getSystemAttrColor(context, SELECTOR_BACKGROUND_COLOR);
	} 
	 
	public static Drawable getSystemAttrDrawable(Context context, int attr) {
		TypedArray a = context.obtainStyledAttributes(new int[] { attr });
		Drawable d = a.getDrawable(a.getIndex(0));
		a.recycle();
		return d;
	} 
} 
6
CodeRank

Related TypedArray getIndex Questions & Answers:

getIndex Method Overview
Return an index in the array that has data.
See Code Examples for other Android TypedArray Methods: