Resources getXml - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:getXml
        assertThat(parser.getName()).isEqualTo("PreferenceScreen");
    } 
 
    @Test(expected = Resources.NotFoundException.class) 
    public void testGetXml_nonexistentResource() { 
        resources.getXml(0);
    } 
 
    @Test 
    public void shouldLoadRawResources() throws Exception { 
        InputStream resourceStream = resources.openRawResource(R.raw.raw_resource);
        assertThat(resourceStream).isNotNull();
        assertThat(TestUtil.readString(resourceStream)).isEqualTo("raw txt file contents");
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
 
	public SeekBarPreference(Context context, AttributeSet attrs) {
		super(context,attrs);
		mContext = context;
 
		mDialogMessage = attrs.getAttributeValue(androidns,"dialogMessage");
		mSuffix = attrs.getAttributeValue(androidns,"text");
		mDefault = attrs.getAttributeIntValue(androidns,"defaultValue", 0);
		mMax = attrs.getAttributeIntValue(androidns,"max", 100);
 
	} 
	@Override 
		protected View onCreateDialogView() {
			LinearLayout.LayoutParams params;
			LinearLayout layout = new LinearLayout(mContext);
			layout.setOrientation(LinearLayout.VERTICAL);
			layout.setPadding(6,6,6,6);
 
			mSplashText = new TextView(mContext);
			if (mDialogMessage != null)
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
		//mSeekBar.setMax(mMaxValue - mMinValue); 
		//mSeekBar.setOnSeekBarChangeListener(this);	 
		} 
 
	private void setValuesFromXml(AttributeSet attrs) {
		mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", 100);
		mMinValue = attrs.getAttributeIntValue(ROBOBUNNYNS, "min", 0);
 
		mUnitsLeft = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsLeft",
				""); 
		String units = getAttributeStringValue(attrs, ROBOBUNNYNS, "units", "");
		mUnitsRight = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsRight",
				units);
		 
		mCurrentValue = attrs.getAttributeIntValue(ANDROIDNS, "summary", 100);
 
		try { 
			String newInterval = attrs.getAttributeValue(ROBOBUNNYNS,
					"interval"); 
			if (newInterval != null)

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
 
    public SeekBarPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
 
        mDialogMessage = attrs.getAttributeValue(androidns, "dialogMessage");
        mSuffix = attrs.getAttributeValue(androidns, "text");
        mDefault = attrs.getAttributeIntValue(androidns, "defaultValue", mMin);
        mMax = attrs.getAttributeIntValue(androidns, "max", 100);
 
    } 
 
    @Override 
    protected View onCreateDialogView() {
        LinearLayout.LayoutParams params;
        LinearLayout layout = new LinearLayout(mContext);
        layout.setOrientation(LinearLayout.VERTICAL);
        layout.setPadding(6, 6, 6, 6);
 
        mSplashText = new TextView(mContext);
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
		mSeekBar.setMax(mMaxValue - mMinValue);
		mSeekBar.setOnSeekBarChangeListener(this);
	} 
 
	private void setValuesFromXml(AttributeSet attrs) {
		mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", 100);
		mMinValue = attrs.getAttributeIntValue(ROUNDRNS, "min", 0);
 
		mUnitsLeft = getAttributeStringValue(attrs, ROUNDRNS, "unitsLeft", "");
		String units = getAttributeStringValue(attrs, ROUNDRNS, "units", "");
		mUnitsRight = getAttributeStringValue(attrs, ROUNDRNS, "unitsRight", units);
 
		try { 
			String newInterval = attrs.getAttributeValue(ROUNDRNS, "interval");
			if (newInterval != null)
				mInterval = Integer.parseInt(newInterval);
		} catch (Exception e) {
			Log.e(TAG, "Invalid interval value", e);
		} 
 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeBooleanValue, getAttributeResourceValue, getAttributeValue
		return mDefaultValue;
	} 
 
	protected void init(final Context context, final AttributeSet attrs) {
		if (attrs != null) {
			final String defaultValue = attrs.getAttributeValue(ANDROID_NS, ATTR_DEFAULTVALUE);
			if (defaultValue != null && defaultValue.startsWith("#")) {
				try { 
					setDefaultValue(Color.parseColor(defaultValue));
				} catch (final IllegalArgumentException e) {
					Log.e("ColorPickerPreference", "Wrong color: " + defaultValue);
					setDefaultValue(Color.WHITE);
				} 
			} else { 
				final int colorResourceId = attrs.getAttributeResourceValue(ANDROID_NS, ATTR_DEFAULTVALUE, 0);
				if (colorResourceId != 0) {
					setDefaultValue(context.getResources().getColor(colorResourceId));
				} 
			} 
			mAlphaSliderEnabled = attrs.getAttributeBooleanValue(null, ATTR_ALPHASLIDER, false);

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
 
	public SeekBarPreference(Context context, AttributeSet attrs) { 
		super(context,attrs); 
		mContext = context;
 
		mDialogMessage = attrs.getAttributeValue(androidns,"dialogMessage");
		mSuffix = attrs.getAttributeValue(androidns,"text");
		mDefault = attrs.getAttributeIntValue(androidns,"defaultValue", 0);
		mMax = attrs.getAttributeIntValue(androidns,"max", 100);
 
	} 
	@Override  
	protected View onCreateDialogView() {
		LinearLayout.LayoutParams params;
		LinearLayout layout = new LinearLayout(mContext);
		layout.setOrientation(LinearLayout.VERTICAL);
		layout.setPadding(6,6,6,6);
 
		mSplashText = new TextView(mContext);
		if (mDialogMessage != null)
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeIntValue, getAttributeResourceValue, getAttributeValue
	private int mDefault=50, mMax=100, mMin=0, mValue = 0;
   
	public SeekBarPreference(Context context, AttributeSet attrs) { 
		super(context,attrs); 
		mContext = context;
		mDefault = attrs.getAttributeIntValue(androidns,"defaultValue", 0);
		mMax = attrs.getAttributeIntValue(androidns,"max", 100);
		mMin = attrs.getAttributeIntValue(askns, "min", 0);
		int titleResId = attrs.getAttributeResourceValue(androidns, "title", 0);
		if (titleResId == 0)
			mTitle = attrs.getAttributeValue(androidns, "title");
		else 
			mTitle = context.getString(titleResId);
	} 
   
	@Override 
	protected View onCreateView(ViewGroup parent) {
		LayoutInflater inflator = (LayoutInflater)mContext.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
		ViewGroup mySeekBarLayout = (ViewGroup)inflator.inflate(R.layout.my_seek_bar_pref, null);
		mSeekBar = (SeekBar) mySeekBarLayout.findViewById(R.id.pref_seekbar);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAttributeIntValue, getAttributeValue
		mSeekBar.setMax(mMaxValue - mMinValue);
		mSeekBar.setOnSeekBarChangeListener(this);
	} 
	 
	private void setValuesFromXml(AttributeSet attrs) {
		mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", 100);
		mMinValue = attrs.getAttributeIntValue(ROBOBUNNYNS, "min", 0);
		 
		mUnitsLeft = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsLeft", "");
		String units = getAttributeStringValue(attrs, ROBOBUNNYNS, "units", "");
		mUnitsRight = getAttributeStringValue(attrs, ROBOBUNNYNS, "unitsRight", units);
		 
		try { 
			String newInterval = attrs.getAttributeValue(ROBOBUNNYNS, "interval");
			if(newInterval != null)
				mInterval = Integer.parseInt(newInterval);
		} 
		catch(Exception e) {
			Log.e(TAG, "Invalid interval value", e);
		} 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getPositionDescription
        String name = sa.getString(R.styleable.Extra_android_name);
        if (name == null) {
            sa.recycle();
            throw new XmlPullParserException("<" + tagName
                    + "> requires an holo:name attribute at " 
                    + attrs.getPositionDescription());
        } 
        TypedValue v = sa.peekValue(R.styleable.Extra_android_value);
        if (v != null) {
            if (v.type == TypedValue.TYPE_STRING) {
                CharSequence cs = v.coerceToString();
                outBundle.putCharSequence(name, cs);
            } else if (v.type == TypedValue.TYPE_INT_BOOLEAN) {
                outBundle.putBoolean(name, v.data != 0);
            } else if (v.type >= TypedValue.TYPE_FIRST_INT
                    && v.type <= TypedValue.TYPE_LAST_INT) {
                outBundle.putInt(name, v.data);
            } else if (v.type == TypedValue.TYPE_FLOAT) {
                outBundle.putFloat(name, v.getFloat());
            } else { 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Resources getXml Questions & Answers:

getXml Method Overview
Return an XmlResourceParser through which you can read a generic XML resource for the given resource ID.
See Code Examples for other Android Resources Methods: