IT. Expert System.

Android Reference

BridgeResources


android.content.res

Class BridgeResources



  • public final class BridgeResources
    extends Resources
    • Method Detail

      • initSystem

        public static Resources initSystem(com.android.layoutlib.bridge.android.BridgeContext context,
                           AssetManager assets,
                           DisplayMetrics metrics,
                           Configuration config,
                           IProjectCallback projectCallback)
        This initializes the static field Resources.mSystem which is used by methods who get global resources using Resources.getSystem().

        They will end up using our bridge resources.

        Bridge calls this method after setting up a new bridge.

      • disposeSystem

        public static void disposeSystem()
        Disposes the static Resources.mSystem to make sure we don't leave objects around that would prevent us from unloading the library.
      • newTypeArray

        public BridgeTypedArray newTypeArray(int numEntries,
                                    boolean platformFile)
      • getDrawable

        public Drawable getDrawable(int id)
                             throws Resources.NotFoundException
        Description copied from class: Resources
        Return a drawable object associated with a particular resource ID. Various types of objects will be returned depending on the underlying resource -- for example, a solid color, PNG image, scalable image, etc. The Drawable API hides these implementation details.

        Note: Prior to Build.VERSION_CODES.JELLY_BEAN, this function would not correctly retrieve the final configuration density when the resource ID passed here is an alias to another Drawable resource. This means that if the density configuration of the alias resource is different than the actual resource, the density of the returned Drawable would be incorrect, resulting in bad scaling. To work around this, you can instead retrieve the Drawable through TypedArray.getDrawable. Use Context.obtainStyledAttributes with an array containing the resource ID of interest to create the TypedArray.

        Overrides:
        getDrawable in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Drawable An object that can be used to draw this resource.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getColor

        public int getColor(int id)
                     throws Resources.NotFoundException
        Description copied from class: Resources
        Return a color integer associated with a particular resource ID. If the resource holds a complex ColorStateList, then the default color from the set is returned.
        Overrides:
        getColor in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Returns a single color value in the form 0xAARRGGBB.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getColorStateList

        public ColorStateList getColorStateList(int id)
                                         throws Resources.NotFoundException
        Description copied from class: Resources
        Return a color state list associated with a particular resource ID. The resource may contain either a single raw color value, or a complex ColorStateList holding multiple possible colors.
        Overrides:
        getColorStateList in class Resources
        Parameters:
        id - The desired resource identifier of a ColorStateList, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Returns a ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getText

        public CharSequence getText(int id)
                             throws Resources.NotFoundException
        Description copied from class: Resources
        Return the string value associated with a particular resource ID. The returned object will be a String if this is a plain string; it will be some other type of CharSequence if it is styled.
        Overrides:
        getText in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        CharSequence The string data associated with the resource, plus possibly styled text information.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getLayout

        public XmlResourceParser getLayout(int id)
                                    throws Resources.NotFoundException
        Description copied from class: Resources
        Return an XmlResourceParser through which you can read a view layout description for the given resource ID. This parser has limited functionality -- in particular, you can't change its input, and only the high-level events are available.

        This function is really a simple wrapper for calling Resources.getXml(int) with a layout resource.

        Overrides:
        getLayout in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        A new parser object through which you can read the XML data.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
        See Also:
        Resources.getXml(int)
      • getAnimation

        public XmlResourceParser getAnimation(int id)
                                       throws Resources.NotFoundException
        Description copied from class: Resources
        Return an XmlResourceParser through which you can read an animation description for the given resource ID. This parser has limited functionality -- in particular, you can't change its input, and only the high-level events are available.

        This function is really a simple wrapper for calling Resources.getXml(int) with an animation resource.

        Overrides:
        getAnimation in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        A new parser object through which you can read the XML data.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
        See Also:
        Resources.getXml(int)
      • obtainTypedArray

        public TypedArray obtainTypedArray(int id)
                                    throws Resources.NotFoundException
        Description copied from class: Resources
        Return an array of heterogeneous values.
        Overrides:
        obtainTypedArray in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Returns a TypedArray holding an array of the array values. Be sure to call TypedArray.recycle() when done with it.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getDimensionPixelOffset

        public int getDimensionPixelOffset(int id)
                                    throws Resources.NotFoundException
        Description copied from class: Resources
        Retrieve a dimensional for a particular resource ID for use as an offset in raw pixels. This is the same as Resources.getDimension(int), except the returned value is converted to integer pixels for you. An offset conversion involves simply truncating the base value to an integer.
        Overrides:
        getDimensionPixelOffset in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Resource dimension value multiplied by the appropriate metric and truncated to integer pixels.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
        See Also:
        Resources.getDimension(int), Resources.getDimensionPixelSize(int)
      • getDimensionPixelSize

        public int getDimensionPixelSize(int id)
                                  throws Resources.NotFoundException
        Description copied from class: Resources
        Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. This is the same as Resources.getDimension(int), except the returned value is converted to integer pixels for use as a size. A size conversion involves rounding the base value, and ensuring that a non-zero base value is at least one pixel in size.
        Overrides:
        getDimensionPixelSize in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Resource dimension value multiplied by the appropriate metric and truncated to integer pixels.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
        See Also:
        Resources.getDimension(int), Resources.getDimensionPixelOffset(int)
      • getInteger

        public int getInteger(int id)
                       throws Resources.NotFoundException
        Description copied from class: Resources
        Return an integer associated with a particular resource ID.
        Overrides:
        getInteger in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Returns the integer value contained in the resource.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getBoolean

        public boolean getBoolean(int id)
                           throws Resources.NotFoundException
        Description copied from class: Resources
        Return a boolean associated with a particular resource ID. This can be used with any integral resource value, and will return true if it is non-zero.
        Overrides:
        getBoolean in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        Returns the boolean value contained in the resource.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getString

        public String getString(int id,
                       Object... formatArgs)
                         throws Resources.NotFoundException
        Description copied from class: Resources
        Return the string value associated with a particular resource ID, substituting the format arguments as defined in Formatter and String.format(java.lang.String, java.lang.Object...). It will be stripped of any styled text information.
        Overrides:
        getString in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        formatArgs - The format arguments that will be used for substitution.
        Returns:
        String The string data associated with the resource, stripped of styled text information.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getString

        public String getString(int id)
                         throws Resources.NotFoundException
        Description copied from class: Resources
        Return the string value associated with a particular resource ID. It will be stripped of any styled text information.
        Overrides:
        getString in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        String The string data associated with the resource, stripped of styled text information.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getValue

        public void getValue(int id,
                    TypedValue outValue,
                    boolean resolveRefs)
                      throws Resources.NotFoundException
        Description copied from class: Resources
        Return the raw data associated with a particular resource ID.
        Overrides:
        getValue in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        outValue - Object in which to place the resource data.
        resolveRefs - If true, a resource that is a reference to another resource will be followed so that you receive the actual final resource data. If false, the TypedValue will be filled in with the reference itself.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getValue

        public void getValue(String name,
                    TypedValue outValue,
                    boolean resolveRefs)
                      throws Resources.NotFoundException
        Description copied from class: Resources
        Return the raw data associated with a particular resource ID. See getIdentifier() for information on how names are mapped to resource IDs, and getString(int) for information on how string resources are retrieved.

        Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.

        Overrides:
        getValue in class Resources
        Parameters:
        name - The name of the desired resource. This is passed to getIdentifier() with a default type of "string".
        outValue - Object in which to place the resource data.
        resolveRefs - If true, a resource that is a reference to another resource will be followed so that you receive the actual final resource data. If false, the TypedValue will be filled in with the reference itself.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • getXml

        public XmlResourceParser getXml(int id)
                                 throws Resources.NotFoundException
        Description copied from class: Resources
        Return an XmlResourceParser through which you can read a generic XML resource for the given resource ID.

        The XmlPullParser implementation returned here has some limited functionality. In particular, you can't change its input, and only high-level parsing events are available (since the document was pre-parsed for you at build time, which involved merging text and stripping comments).

        Overrides:
        getXml in class Resources
        Parameters:
        id - The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
        Returns:
        A new parser object through which you can read the XML data.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
        See Also:
        AttributeSet
      • openRawResource

        public InputStream openRawResource(int id)
                                    throws Resources.NotFoundException
        Description copied from class: Resources
        Open a data stream for reading a raw resource. This can only be used with resources whose value is the name of an asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources.
        Overrides:
        openRawResource in class Resources
        Parameters:
        id - The resource identifier to open, as generated by the appt tool.
        Returns:
        InputStream Access to the resource data.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • openRawResource

        public InputStream openRawResource(int id,
                                  TypedValue value)
                                    throws Resources.NotFoundException
        Description copied from class: Resources
        Open a data stream for reading a raw resource. This can only be used with resources whose value is the name of an asset file -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources.
        Overrides:
        openRawResource in class Resources
        Parameters:
        id - The resource identifier to open, as generated by the appt tool.
        value - The TypedValue object to hold the resource information.
        Returns:
        InputStream Access to the resource data.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.
      • openRawResourceFd

        public AssetFileDescriptor openRawResourceFd(int id)
                                              throws Resources.NotFoundException
        Description copied from class: Resources
        Open a file descriptor for reading a raw resource. This can only be used with resources whose value is the name of an asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources.

        This function only works for resources that are stored in the package as uncompressed data, which typically includes things like mp3 files and png images.

        Overrides:
        openRawResourceFd in class Resources
        Parameters:
        id - The resource identifier to open, as generated by the appt tool.
        Returns:
        AssetFileDescriptor A new file descriptor you can use to read the resource. This includes the file descriptor itself, as well as the offset and length of data where the resource appears in the file. A null is returned if the file exists but is compressed.
        Throws:
        Resources.NotFoundException - Throws NotFoundException if the given ID does not exist.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 636 / 158861909. Delta: 0.05017 с