TypedArray getInteger - 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 getInteger method.

This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle
This code example shows how to use the following methods:getInteger
		} 
	} 
 
	@Override 
	protected Object onGetDefaultValue(TypedArray a, int index) {
		return a.getInteger(index, DEFAULT_VALUE);
	} 
 
	@Override 
	public void setDefaultValue(Object defaultValue) {
		super.setDefaultValue(defaultValue);
		mCurrentValue = defaultValue instanceof Integer ? (Integer) defaultValue
				: Integer.parseInt(defaultValue.toString());
	} 
	 
	 
	@Override 
	protected void onBindDialogView(View view) {
		super.onBindDialogView(view);
		this.mNumberPicker = (NumberPicker) view
5
CodeRank
This code example shows how to use the following methods:getInteger
 
    @Override 
    protected Object onGetDefaultValue(TypedArray a, int index) {
        // This preference type's value type is Integer, so we read the default 
        // value from the attributes as an Integer. 
        return a.getInteger(index, 0);
    } 
 
    @Override 
    protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
        if (restoreValue) {
            // Restore state 
            mClickCounter = getPersistedInt(mClickCounter);
        } else { 
            // Set state 
            int value = (Integer) defaultValue;
            mClickCounter = value;
            persistInt(value);
        } 
    } 
5
CodeRank
This code example shows how to use the following methods:getInteger, recycle
 
	public int getInteger(String attrName, int defaultValue) {
		int[] attr = ThemeUtils.getAttributeIds(mContext,
				new String[] { attrName }, mPackageName);
		TypedArray a = mContext.obtainStyledAttributes(mThemeId, attr);
		int i = a.getInteger(0, defaultValue);
		a.recycle();
		return i;
	} 
 
	public int getResourceId(String attrName, int defaultValue) {
		int[] attr = ThemeUtils.getAttributeIds(mContext,
				new String[] { attrName }, mPackageName);
		TypedArray a = mContext.obtainStyledAttributes(mThemeId, attr);
		int i = a.getResourceId(0, defaultValue);
		a.recycle();
		return i;
	} 
 
	public String getString(String attrName) {
6
CodeRank
This code example shows how to use the following methods:getInteger
    } 
     
    @Override 
    protected Object onGetDefaultValue( TypedArray a, int index )
    { 
        return a.getInteger( index, DEFAULT_VALUE );
    } 
     
    @Override 
    protected void onSetInitialValue( boolean restorePersistedValue, Object defaultValue )
    { 
        try 
        { 
            setValue( restorePersistedValue ? getPersistedInt( mValue ) : (Integer) defaultValue );
        } 
        catch( ClassCastException e )
        { 
            // Using an obsolete file for persistence 
            Log.w( "CheatPreference", "Failure setting initial value", e );
            setValue( DEFAULT_VALUE );
5
CodeRank
This code example shows how to use the following methods:getInteger, recycle
        // Attribute initialization 
        final TypedArray a = context.obtainStyledAttributes(attrs, new int[]{
                android.R.attr.maxLines
        }, defStyle, 0);
 
        mMaxLines = a.getInteger(0, 1);
        a.recycle();
    } 
 
    @Override 
    public void setText(CharSequence text, BufferType type) {
        CharSequence newText = getWidth() == 0 || mMaxLines > MAX_ELLIPSIZE_LINES ? text :
                TextUtils.ellipsize(text, getPaint(), getWidth() * mMaxLines,
                        TextUtils.TruncateAt.END, false, null);
        super.setText(newText, type);
    } 
 
    @Override 
    protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
        super.onSizeChanged(width, height, oldWidth, oldHeight);
5
CodeRank
This code example shows how to use the following methods:getDimensionPixelSize, getDrawable, getInteger, recycle

Related TypedArray getInteger Questions & Answers:

getInteger Method Overview
Retrieve the integer value for the attribute at index.
See Code Examples for other Android TypedArray Methods: