Read styled attributes, they will defined in an AlertDialog shown by the given activity.
You must call {@link TypedArray#recycle()} after having read the desired attributes.
@see Context#obtainStyledAttributes(android.util.AttributeSet, int[], int, int)
505227
@SuppressLint("Recycle")
    public static TypedArray getDialogStyledAttributes(Context activity, int[] attrs, int defStyleAttr, int defStyleRef) {
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        AlertDialog dialog = builder.create();
        TypedArray ta = dialog.getContext().obtainStyledAttributes(null, attrs, defStyleAttr, defStyleRef);
        dialog.dismiss();
        return ta;
    }
1251042
private void readInstance(StreamTokenizer tokenizer, AttributeDataset data, Attribute[] attributes) throws IOException, ParseException {
        double[] x = responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
        double y = Double.NaN;
        
        // Get values for all attributes.
        for (int i = 0, k = 0; i < attributes.length; i++) {
            // Get next token
            if (i > 0) {
                getNextToken(tokenizer);
            }

            if (i == responseIndex) {
                if (tokenizer.ttype == '?') {
                    y = Double.NaN;
                } else {
                    y = attributes[i].valueOf(tokenizer.sval);
                }
            } else {
                if (tokenizer.ttype == '?') {
                    x[k++] = Double.NaN;
                } else {
                    x[k++] = attributes[i].valueOf(tokenizer.sval);
                }
            }
        }

        if (Double.isNaN(y)) data.add(x); else data.add(x, y);
    }
27811
def selected_attributes(self):
        
        array = javabridge.call(self.jobject, "selectedAttributes", "()[I")
        if array is None:
            return None
        else:
            return javabridge.get_env().get_int_array_elements(array)
440476
protected void parseAttributes() {
        burnWhitespaces();
        attribute = null;
        while (reader.hasNextCharacter()) {
            char character = reader.peekCharacter();
            if (Strings.isNewLine(character) && (attribute != null || Strings.isNotEmpty(builder))) {
                throwException("Expecting line end marker: '" + lineEnd + "'.");
            }
            character = next();
            if (Strings.isNewLine(character) && (attribute != null || Strings.isNotEmpty(builder))) {
                // Needs double check, possible comment along the way.
                throwException("Expecting line end marker: '" + lineEnd + "'.");
            } else if (character == blockClosing) {
                if (attribute != null || Strings.isNotEmpty(builder)) {
                    throwException("Unexpected tag close.");
                }
                return;
            } else if (Strings.isWhitespace(character) && attribute == null) {
                continue;
            } else if (character == separator && attribute == null) {
                addAttributeName();
                continue;
            } else if (character == lineEnd) {
                if (attribute == null) {
                    throwException("Found unexpected line end marker: '" + lineEnd + "'. Is separator (" + separator
                            + ") missing?");
                }
                addAttribute();
            } else {
                builder.append(character);
            }
        }
    }
794554
private void getAttributes(Context context, AttributeSet attrs) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PinView);

        if (typedArray != null) {
            try {
                mNumberPinBoxes = typedArray
                        .getInteger(R.styleable.PinView_numberPinBoxes, PinViewSettings.DEFAULT_NUMBER_PIN_BOXES);
                mMaskPassword = typedArray
                        .getBoolean(R.styleable.PinView_password, PinViewSettings.DEFAULT_MASK_PASSWORD);
                mNumberCharacters = typedArray
                        .getInteger(R.styleable.PinView_numberCharacters, PinViewSettings.DEFAULT_NUMBER_CHARACTERS);
                mSplit = typedArray.getString(R.styleable.PinView_split);
                mKeyboardMandatory = typedArray
                        .getBoolean(R.styleable.PinView_keyboardMandatory, PinViewSettings.DEFAULT_KEYBOARD_MANDATORY);
                mDeleteOnClick = typedArray
                        .getBoolean(R.styleable.PinView_deleteOnClick, PinViewSettings.DEFAULT_DELETE_ON_CLICK);
                mNativePinBox = typedArray
                        .getBoolean(R.styleable.PinView_nativePinBox, PinViewSettings.DEFAULT_NATIVE_PIN_BOX);
                mCustomDrawablePinBox = typedArray
                        .getResourceId(R.styleable.PinView_drawablePinBox, PinViewSettings.DEFAULT_CUSTOM_PIN_BOX);
                mColorTextPinBoxes = typedArray
                        .getColor(R.styleable.PinView_colorTextPinBox,
                                getResources().getColor(PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX));
                mColorTextTitles = typedArray
                        .getColor(R.styleable.PinView_colorTextTitles,
                                getResources().getColor(PinViewSettings.DEFAULT_TEXT_COLOR_TITLES));
                mColorSplit = typedArray
                        .getColor(R.styleable.PinView_colorSplit,
                                getResources().getColor(PinViewSettings.DEFAULT_COLOR_SPLIT));
                mTextSizePinBoxes = typedArray
                        .getDimension(R.styleable.PinView_textSizePinBox,
                                getResources().getDimension(PinViewSettings.DEFAULT_TEXT_SIZE_PIN_BOX));
                mTextSizeTitles = typedArray
                        .getDimension(R.styleable.PinView_textSizeTitles,
                                getResources().getDimension(PinViewSettings.DEFAULT_TEXT_SIZE_TITLES));
                mSizeSplit = typedArray
                        .getDimension(R.styleable.PinView_sizeSplit,
                                getResources().getDimension(PinViewSettings.DEFAULT_SIZE_SPLIT));

                int titles;
                titles = typedArray.getResourceId(R.styleable.PinView_titles, -1);
                if (titles != -1) {
                    setTitles(getResources().getStringArray(titles));
                }

                if (this.mNumberPinBoxes != 0) {
                    setPin(this.mNumberPinBoxes);
                }

            } catch (Exception e) {
                Log.e(LOG_TAG, "Error while creating the view PinView: ", e);
            } finally {
                typedArray.recycle();
            }
        }
    }
639892
private void  parseAttributesStyle(SvgElementBase obj, Attributes attributes) throws SVGParseException
   {
      for (int i=0; i<attributes.getLength(); i++)
      {
         String  val = attributes.getValue(i).trim();
         if (val.length() == 0) {  // Empty attribute. Ignore it.
            continue;
         }
         //boolean  inherit = val.equals("inherit");   // NYI

         switch (SVGAttr.fromString(attributes.getLocalName(i)))
         {
            case style:
               parseStyle(obj, val);
               break;

            case CLASS:
               obj.classNames = CSSParser.parseClassAttribute(val);
               break;

            default:
               if (obj.baseStyle == null)
                  obj.baseStyle = new Style();
               processStyleProperty(obj.baseStyle, attributes.getLocalName(i), attributes.getValue(i).trim());
               break;
         }
      }
   }
178291
function getAttrs(element) {
  return Array.from(element.attributes).reduce((attrs, attr) => {
    attrs[attr.name] = attr.value;
    return attrs;
  }, {});
}
475091
public static void parseCommonStoreAttributes(XMLExtendedStreamReader reader, StoreConfigurationBuilder builder, String attributeName, String value, int i) throws XMLStreamException {
      switch (Attribute.forName(attributeName)) {
         case FETCH_PERSISTENT_STATE:
            builder.fetchPersistentState(Boolean.valueOf(value));
            break;
         case IGNORE_MODIFICATIONS:
            builder.ignoreModifications(Boolean.valueOf(value));
            break;
         case PURGE_ON_STARTUP:
            builder.purgeOnStartup(Boolean.valueOf(value));
            break;
         case PRELOAD:
            builder.preload(Boolean.parseBoolean(value));
            break;
         case SHARED:
            builder.shared(Boolean.parseBoolean(value));
            break;
         default:
            throw ParseUtils.unexpectedAttribute(reader, i);
      }
   }
1374039
private void obtainDialogTheme(@NonNull final TypedArray typedArray) {
        int themeId = typedArray.getResourceId(R.styleable.DialogPreference_dialogThemeResource, 0);

        if (themeId == 0) {
            TypedValue typedValue = new TypedValue();
            getContext().getTheme()
                    .resolveAttribute(R.attr.preferenceDialogTheme, typedValue, true);
            themeId = typedValue.resourceId;
        }

        dialogTheme = themeId != 0 ? themeId : R.style.MaterialDialog_Light;
    }
1370906
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircularSlider, defStyleAttr, 0);

        // read all available attributes
        float startAngle = a.getFloat(R.styleable.CircularSlider_start_angle, (float) Math.PI / 2);
        float angle = a.getFloat(R.styleable.CircularSlider_angle, (float) Math.PI / 2);
        int thumbSize = a.getDimensionPixelSize(R.styleable.CircularSlider_thumb_size, 50);
        int thumbColor = a.getColor(R.styleable.CircularSlider_thumb_color, Color.GRAY);
        int borderThickness = a.getDimensionPixelSize(R.styleable.CircularSlider_border_thickness, 20);
        int borderColor = a.getColor(R.styleable.CircularSlider_border_color, Color.RED);
        String borderGradientColors = a.getString(R.styleable.CircularSlider_border_gradient_colors);
        Drawable thumbImage = a.getDrawable(R.styleable.CircularSlider_thumb_image);

        // save those to fields (really, do we need setters here..?)
        setStartAngle(startAngle);
        setAngle(angle);
        setBorderThickness(borderThickness);
        setBorderColor(borderColor);
        if (borderGradientColors != null) {
            setBorderGradientColors(borderGradientColors.split(";"));
        }
        setThumbSize(thumbSize);
        setThumbImage(thumbImage);
        setThumbColor(thumbColor);

        // assign padding - check for version because of RTL layout compatibility
        int padding;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            int all = getPaddingLeft() + getPaddingRight() + getPaddingBottom() + getPaddingTop() + getPaddingEnd() + getPaddingStart();
            padding = all / 6;
        } else {
            padding = (getPaddingLeft() + getPaddingRight() + getPaddingBottom() + getPaddingTop()) / 4;
        }
        setPadding(padding);

        a.recycle();
    }
877638
@Override
    int read_attribute_asynch_i(final String a, final boolean fwd, final int rid) throws DevFailed {
	synchronized (this) {
	    final Iterator it = elements.iterator();
	    while (it.hasNext()) {
		final GroupElement e = (GroupElement) it.next();
		if (e instanceof GroupDeviceElement || fwd) {
		    e.read_attribute_asynch_i(a, fwd, rid);
		}
	    }
	    return rid;
	}
    }
1326362
public AttributeValue[] read_attributes_2(final String[] names, final DevSource source)
	    throws DevFailed {
	Util.out4.println("DeviceImpl.read_attributes_2 arrived src=" + source.value());

	// If the source parameter specifies device, call the read_attribute
	// method implemented by the DeviceImpl class
	if (source == DevSource.DEV) {
	    return read_attributes(names);
	}

	// final boolean att_in_fault = false;
	boolean polling_failed = false;

	// Record operation request in black box
	blackbox.insert_op(Op_Read_Attr_2);

	AttributeValue[] back = null;

	try {
	    // Build a sequence with the names of the attribute to be read.
	    // This is necessary in case of the "AllAttr" shortcut is used
	    // If all attributes are wanted, build this list
	    int i, j;
	    boolean all_attr = false;
	    final Vector poll_list = get_poll_obj_list(); // PollObj
	    final int nb_poll = poll_list.size();
	    final int nb_names = names.length;
	    String[] real_names = names;
	    // Check if All Attr
	    if (nb_names == 1) {
		final String att_name = names[0];
		if (att_name.equals(Tango_AllAttr)) {
		    all_attr = true;
		    int nb_real = 0;
		    // Get the real number
		    for (i = 0; i < nb_poll; i++) {
			final PollObj poll_obj = (PollObj) poll_list.elementAt(i);
			if (poll_obj.get_type() == Tango_POLL_ATTR) {
			    nb_real++;
			}
		    }
		    // get the real polle object
		    real_names = new String[nb_real];
		    for (i = 0, j = 0; i < nb_poll && j < nb_real; i++) {
			final PollObj poll_obj = (PollObj) poll_list.elementAt(i);
			if (poll_obj.get_type() == Tango_POLL_ATTR) {
			    real_names[j++] = poll_obj.get_name();
			}
		    }
		}
	    }

	    // Check that device supports the wanted attribute
	    if (all_attr == false) {
		for (i = 0; i < real_names.length; i++) {
		    dev_attr.get_attr_ind_by_name(real_names[i]);
		}
	    }
	    // Check that all wanted attributes are polled.
	    // If some are non polled, store
	    // their name in the real_names sequence in a vector
	    final Vector non_polled = new Vector(); // String
	    if (all_attr == false) {
		for (i = 0; i < real_names.length; i++) {
		    for (j = 0; j < nb_poll; j++) {
			final PollObj poll_obj = (PollObj) poll_list.elementAt(j);
			if (poll_obj.get_name().equals(real_names[i].toLowerCase())) {
			    break;
			}
		    }
		    if (j == nb_poll) {
			non_polled.add(real_names[i]);
		    }
		}
	    }
	    // If some attributes are not polled but their polling update period
	    // is defined,
	    // and the attribute is not in the device list of attr which should
	    // not be
	    // polled, start to poll them
	    final Vector poll_period = new Vector();
	    if (non_polled.size() != 0) {
		// Check that it is possible to start polling for the non polled
		// attribute
		for (i = 0; i < non_polled.size(); i++) {
		    final String non_polled_name = (String) non_polled.elementAt(i);
		    final Attribute att = dev_attr.get_attr_by_name(non_polled_name);

		    poll_period.add(att.get_polling_period());

		    if (att.get_polling_period() == 0) {
			Except.throw_exception("API_AttrNotPolled", "Attribute " + non_polled_name
				+ " not polled", "Device_2Impl.read_attributes");
		    } else {
			boolean found = false;
			final Vector napa = get_non_auto_polled_attr();

			for (j = 0; j < napa.size(); j++) {
			    final String napa_str = ((String) napa.elementAt(j)).toLowerCase();
			    if (napa_str.equals(non_polled_name.toLowerCase())) {
				found = true;
			    }
			}

			if (found) {
			    Except.throw_exception("API_AttrNotPolled", "Attribute "
				    + non_polled_name + " not polled",
				    "Device_2Impl.read_attributes");
			}
		    }
		}
		// Start polling
		final Util tg = Util.instance();
		final DServer adm_dev = tg.get_dserver_device();

		final DevVarLongStringArray send = new DevVarLongStringArray();
		send.lvalue = new int[1];
		send.svalue = new String[3];
		send.svalue[0] = device_name;
		send.svalue[1] = "attribute";

		for (i = 0; i < non_polled.size(); i++) {
		    send.lvalue[0] = (Integer) poll_period.elementAt(i);
		    send.svalue[2] = (String) non_polled.elementAt(i);

		    adm_dev.add_obj_polling(send, false);
		}
	    }

	    // Allocate memory for the AttributeValue structures
	    final int nb_attr = real_names.length;
	    back = new AttributeValue[nb_attr];

	    // For each attribute, check that some data are available in cache
	    // and that they
	    // are not too old
	    for (i = 0; i < nb_attr; i++) {
		PollObj polled_attr = null;
		for (j = 0; j < poll_list.size(); j++) {
		    final PollObj poll_obj = (PollObj) poll_list.elementAt(j);
		    if (poll_obj.get_type() == Tango_POLL_ATTR
			    && poll_obj.get_name().toLowerCase()
				    .equals(real_names[i].toLowerCase())) {
			polled_attr = poll_obj;
			break;
		    }
		}

		// Check that some data is available in cache
		if (polled_attr.is_ring_empty() == true) {
		    Except.throw_exception("API_NoDataYet",
			    "No data available in cache for attribute " + real_names[i],
			    "Device_2Impl.read_attributes");
		}

		// Check that data are still refreshed by the polling thread
		final long ctm = System.currentTimeMillis();
		int tv_sec = (int) (ctm / 1000);
		final int tv_usec = (int) (ctm - 1000 * tv_sec) * 1000;
		tv_sec = tv_sec - Tango_DELTA_T;

		final double last = polled_attr.get_last_insert_date();
		final double now_d = tv_sec + (double) tv_usec / 1000000;
		final double diff_d = now_d - last;
		if (diff_d > polled_attr.get_authorized_delta()) {
		    Except.throw_exception("API_NotUpdatedAnyMore", "Data in cache for attribute "
			    + real_names[i] + " not updated any more",
			    "Device_2Impl.read_attributes");
		}

		// Finally, after all these checks, get value and store it in
		// the
		// sequence sent back to user
		// In order to avoid unnecessary copy, don't use the assignement
		// operator of the
		// AttributeValue structure which copy each element and
		// therefore also copy
		// the Any object. The Any assignement operator is a deep copy!
		// Create a new sequence using the attribute buffer and insert
		// it into the
		// Any. The sequence inside the source Any has been created
		// using the attribute
		// data buffer.
		back[i] = polled_attr.get_last_attr_value();
	    }
	} catch (final DevFailed e) {
	    if (source == DevSource.CACHE) {
		throw e;
	    }
	    // if (att_in_fault == true) {
	    // throw e;
	    // }
	    polling_failed = true;
	}

	// If the source parameter is CACHE, returned data,
	// else call method reading attribute from device
	if (source == DevSource.CACHE_DEV && polling_failed == true) {
	    back = read_attributes(names);
	}
	return back;
    }
775853
@Override
    public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in ) {

        if ( LOG.isDebugEnabled() ) {
            LOG.debug( "Reading serialized data:\n" + new String( in ) );
        }

        return doDeserialize( in, "attributes" );
    }
1180938
private void obtainDialogTitle(@NonNull final TypedArray typedArray) {
        CharSequence title = typedArray.getText(R.styleable.DialogPreference_android_dialogTitle);
        setDialogTitle(title != null ? title : getTitle());
    }
719990
@SuppressLint("PrivateResource")
    private static Context themifyContext(Context context, AttributeSet attrs, boolean useAppTheme) {
        final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.View, 0, 0);
        int themeId = a.getResourceId(R.styleable.View_android_theme, 0);
        if (useAppTheme && themeId == 0) {
            // ...if that didn't work, try reading app:theme (for legacy reasons) if enabled
            themeId = a.getResourceId(R.styleable.View_theme, 0);

            if (themeId != 0) {
                Log.i(LOG_TAG, "app:theme is now deprecated. "
                        + "Please move to using android:theme instead.");
            }
        }
        a.recycle();

        if (themeId != 0 && (!(context instanceof ContextThemeWrapper)
                || ((ContextThemeWrapper) context).getThemeResId() != themeId)) {
            // If the context isn't a ContextThemeWrapper, or it is but does not have
            // the same theme as we need, wrap it in a new wrapper
            context = new ContextThemeWrapper(context, themeId);
        }
        return context;
    }
170836
static String extractStyle(String style, String attribute) {
		if (style == null) {
			return "";
		}
		
		StringTokenizer tokens = new StringTokenizer(style,";");
		
		while (tokens.hasMoreTokens()) {
			String token = tokens.nextToken();
			String key = token.substring(0,token.indexOf(':'));
			if (key.equals(attribute)) {
				return token.substring(token.indexOf(':')+1);
			}
		}
		
		return "";
	}
804275
protected final void decodeAttributeXsiNilStructure() throws EXIException,
			IOException {
		attributeQNameContext = getXsiNilContext();
		// handle AT prefix
		handleAttributePrefix(attributeQNameContext);

		if (preserveLexicalValues) {
			// as String
			attributeValue = typeDecoder.readValue(booleanDatatype,
					getXsiNilContext(), channel, stringDecoder);
		} else {
			// as Boolean
			attributeValue = channel.decodeBooleanValue();
			// attributeValue = booleanDatatype.readValue(null, channel,
			// stringDecoder);
		}

		boolean xsiNil = false;

		if (attributeValue instanceof BooleanValue) {
			BooleanValue bv = (BooleanValue) attributeValue;
			xsiNil = bv.toBoolean();
		} else {
			// parse string value again (lexical value mode)
			if (attributeValue instanceof BooleanValue) {
				xsiNil = ((BooleanValue) attributeValue).toBoolean();
			} else {
				BooleanValue bv = BooleanValue.parse(attributeValue.toString());
				if (bv != null) {
					xsiNil = bv.toBoolean();
				}
			}
			// booleanDatatype.isValid(attributeValue);
			// xsiNil = booleanDatatype.getBoolean();
		}

		final Grammar currentGrammar = getCurrentGrammar();
		if (xsiNil && currentGrammar.isSchemaInformed()) {
			// jump to typeEmpty
			updateCurrentRule(((SchemaInformedFirstStartTagGrammar) currentGrammar)
					.getTypeEmpty());
		}
	}