public abstract class ResourceManager extends Object
Manages all resources in the resources directory of the application package.
ResourceManager instances are obtained only from the context.
Resource,
ResourceType| 构造器 | 说明 |
|---|---|
ResourceManager() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
abstract Pattern |
createPattern(List<TypedAttribute.AttrData> data) |
Creates a
Pattern instance based on the array that contains
TypedAttribute.AttrData. |
abstract Theme |
createTheme(List<TypedAttribute.AttrData> data) |
Creates a
Theme instance based on the array that contains
TypedAttribute.AttrData. |
abstract ConfigManager |
getConfigManager() |
Obtains
ConfigManager to get global configurations. |
abstract Configuration |
getConfiguration() |
Obtains the current configuration.
|
abstract DeviceCapability |
getDeviceCapability() |
Obtains the device capability.
|
abstract Element |
getElement(int resId) |
Obtains an
Element object based on its resource ID. |
abstract String |
getIdentifier(int resId) |
Obtains the resource name based on the resource ID.
|
abstract String |
getMediaPath(int resId) |
Obtains the media file path based on the resource ID.
|
abstract RawFileEntry |
getRawFileEntry(String path) |
Obtains a
RawFileEntry object based on the raw file path to open a raw file. |
abstract Resource |
getResource(int resId) |
Obtains the resource based on the resource ID.
|
abstract SolidXml |
getSolidXml(int resId) |
Obtains a solid XML document based on the resource ID.
|
abstract Theme |
getTheme(int resId) |
已过时。
This change is effective since API version 4. Replaced by
Element#getTheme() |
abstract void |
updateConfiguration(Configuration config,
DeviceCapability capability) |
Updates the configuration by modifying the configuration and device capability.
|
public abstract Resource getResource(int resId) throws IOException, NotExistException
resId - Indicates the resource ID.null if the resource ID
does not match any resources.NotExistException - Throws this exception if the resource ID does not match
any resources. The resource ID must be automatically
generated by the IDE or resource tool, or provided by
the system.IOException - Throws this exception if an I/O error occurs during
resource read.public abstract String getIdentifier(int resId) throws IOException, NotExistException
resId - Indicates the resource ID.null if the resource ID
does not match any resources.NotExistException - Throws this exception if the resource ID does not match
any resources. The resource ID must be automatically
generated by the IDE or resource tool, or provided by
the system.IOException - Throws this exception if an I/O error occurs during
resource read.public abstract Element getElement(int resId) throws IOException, NotExistException, WrongTypeException
Element object based on its resource ID.resId - Indicates the resource ID.Element object associated with the resource ID.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the Element type.Element@Deprecated public abstract Theme getTheme(int resId) throws IOException, NotExistException, WrongTypeException
Element#getTheme()Theme instance based on
the resource ID.resId - Indicates the resource ID.Theme instance.NotExistException - Throws this exception if the resource ID does not
match any resources. The resource ID must be
automatically generated by the IDE or resource
tool, or provided by the system.IOException - Throws this exception if an I/O error occurs
during resource read.WrongTypeException - Throws this exception if the resource is not of
the Theme type.Themepublic abstract SolidXml getSolidXml(int resId) throws IOException, NotExistException, WrongTypeException
resId - Indicates the resource ID.null
if an error occurs during conversion to a solid XML document.NotExistException - Throws this exception if the resource ID does not match
any resources. The resource ID must be automatically
generated by the IDE or resource tool, or provided by
the system.IOException - Throws this exception if an I/O error occurs during
resource read.WrongTypeException - Throws this exception if the resource is not of the
Solid XML type.public abstract RawFileEntry getRawFileEntry(String path)
RawFileEntry object based on the raw file path to open a raw file.path - Indicates the raw file path.RawFileEntry object.RawFileEntrypublic abstract ConfigManager getConfigManager()
ConfigManager to get global configurations.ConfigManager object; returns null if an error
occurs.ConfigManagerpublic abstract String getMediaPath(int resId) throws IOException, NotExistException, WrongTypeException
resId - Indicates the resource ID.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string type.public abstract Configuration getConfiguration()
public abstract DeviceCapability getDeviceCapability()
DeviceCapabilitypublic abstract void updateConfiguration(Configuration config, DeviceCapability capability)
config - Indicates the new configuration.capability - Indicates the new device capability.public abstract Pattern createPattern(List<TypedAttribute.AttrData> data)
Pattern instance based on the array that contains
TypedAttribute.AttrData.data - Indicates the set of attribute data. Each attribute data has its own name, value, and type.Pattern instance.public abstract Theme createTheme(List<TypedAttribute.AttrData> data)
Theme instance based on the array that contains
TypedAttribute.AttrData.data - Indicates the set of attribute data. Each attribute data has its own name, value, and type.Theme instance.