1# ohresmgr.h 2 3<!--Kit: Localization Kit--> 4<!--Subsystem: Global--> 5<!--Owner: @liule_123--> 6<!--Designer: @buda_wy--> 7<!--Tester: @lpw_work--> 8<!--Adviser: @Brilliantry_Rui--> 9 10## 概述 11 12提供资源管理native侧获取资源的能力。 13 14**引用文件:** <resourcemanager/ohresmgr.h> 15 16**库:** libohresmgr.so 17 18**系统能力:** SystemCapability.Global.ResourceManager 19 20**起始版本:** 12 21 22**相关模块:** [resourcemanager](capi-resourcemanager.md) 23 24## 汇总 25 26### 函数 27 28| 名称 | 描述 | 29| -- | -- | 30| [ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64(const NativeResourceManager *mgr, uint32_t resId,char **resultValue, uint64_t *resultLen, uint32_t density = 0)](#oh_resourcemanager_getmediabase64) | 通过指定资源ID,获取屏幕密度对应的media资源的Base64码。 | 31| [ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64Data(const NativeResourceManager *mgr, uint32_t resId,char **resultValue, uint64_t *resultLen, uint32_t density)](#oh_resourcemanager_getmediabase64data) | 通过指定资源ID,获取屏幕密度对应的media资源的Base64码。 | 32| [ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName(const NativeResourceManager *mgr,const char *resName, char **resultValue, uint64_t *resultLen, uint32_t density = 0)](#oh_resourcemanager_getmediabase64byname) | 通过指定资源名称,获取屏幕密度对应的media资源的Base64码。 | 33| [ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64DataByName(const NativeResourceManager *mgr,const char *resName, char **resultValue, uint64_t *resultLen, uint32_t density)](#oh_resourcemanager_getmediabase64databyname) | 通过指定资源名称,获取屏幕密度对应的media资源的Base64码。 | 34| [ResourceManager_ErrorCode OH_ResourceManager_GetMedia(const NativeResourceManager *mgr, uint32_t resId,uint8_t **resultValue, uint64_t *resultLen, uint32_t density = 0)](#oh_resourcemanager_getmedia) | 通过指定资源ID,获取屏幕密度对应的media资源的内容。 | 35| [ResourceManager_ErrorCode OH_ResourceManager_GetMediaData(const NativeResourceManager *mgr, uint32_t resId,uint8_t **resultValue, uint64_t *resultLen, uint32_t density)](#oh_resourcemanager_getmediadata) | 通过指定资源ID,获取屏幕密度对应的media资源的内容。 | 36| [ResourceManager_ErrorCode OH_ResourceManager_GetMediaByName(const NativeResourceManager *mgr, const char *resName,uint8_t **resultValue, uint64_t *resultLen, uint32_t density = 0)](#oh_resourcemanager_getmediabyname) | 通过指定资源名称,获取屏幕密度对应的media资源的内容。 | 37| [ResourceManager_ErrorCode OH_ResourceManager_GetMediaDataByName(const NativeResourceManager *mgr, const char *resName,uint8_t **resultValue, uint64_t *resultLen, uint32_t density)](#oh_resourcemanager_getmediadatabyname) | 通过指定资源名称,获取屏幕密度对应的media资源的内容。 | 38| [ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor(const NativeResourceManager *mgr,uint32_t resId, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0)](#oh_resourcemanager_getdrawabledescriptor) | 通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。 | 39| [ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorData(const NativeResourceManager *mgr,uint32_t resId, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density, uint32_t type)](#oh_resourcemanager_getdrawabledescriptordata) | 通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。 | 40| [ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName(const NativeResourceManager *mgr,const char *resName, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0)](#oh_resourcemanager_getdrawabledescriptorbyname) | 通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。 | 41| [ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorDataByName(const NativeResourceManager *mgr,const char *resName, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density, uint32_t type)](#oh_resourcemanager_getdrawabledescriptordatabyname) | 通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。 | 42| [ResourceManager_ErrorCode OH_ResourceManager_GetSymbol(const NativeResourceManager *mgr, uint32_t resId,uint32_t *resultValue)](#oh_resourcemanager_getsymbol) | 通过指定资源ID,获取对应的symbol资源。 | 43| [ResourceManager_ErrorCode OH_ResourceManager_GetSymbolByName(const NativeResourceManager *mgr, const char *resName,uint32_t *resultValue)](#oh_resourcemanager_getsymbolbyname) | 通过指定资源名称,获取对应的symbol资源。 | 44| [ResourceManager_ErrorCode OH_ResourceManager_GetLocales(const NativeResourceManager *mgr, char ***resultValue,uint32_t *resultLen, bool includeSystem = false)](#oh_resourcemanager_getlocales) | 获取语言列表。使用此接口后,需要调用[OH_ResourceManager_ReleaseStringArray()](#oh_resourcemanager_releasestringarray)方法来释放localinfo的内存。 | 45| [ResourceManager_ErrorCode OH_ResourceManager_GetLocalesData(const NativeResourceManager *mgr, char ***resultValue,uint32_t *resultLen, bool includeSystem)](#oh_resourcemanager_getlocalesdata) | 获取语言列表。使用此接口后,需要调用[OH_ResourceManager_ReleaseStringArray()](#oh_resourcemanager_releasestringarray)方法来释放localinfo的内存。 | 46| [ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration(const NativeResourceManager *mgr,ResourceManager_Configuration *configuration)](#oh_resourcemanager_getconfiguration) | 获取设备配置。使用此接口后,需要调用[OH_ResourceManager_ReleaseConfiguration()](#oh_resourcemanager_releaseconfiguration)方法来释放内存。如果使用malloc创建ResourceManager_Configuration对象,还需要调用free()方法来释放它。 | 47| [ResourceManager_ErrorCode OH_ResourceManager_GetResourceConfiguration(const NativeResourceManager *mgr,ResourceManager_Configuration *configuration)](#oh_resourcemanager_getresourceconfiguration) | 获取设备配置。使用此接口后,需要调用[OH_ResourceManager_ReleaseConfiguration()](#oh_resourcemanager_releaseconfiguration)方法来释放内存。如果使用malloc创建ResourceManager_Configuration对象,还需要调用free()方法来释放它。 | 48| [ResourceManager_ErrorCode OH_ResourceManager_ReleaseConfiguration(ResourceManager_Configuration *configuration)](#oh_resourcemanager_releaseconfiguration) | 释放[OH_ResourceManager_GetConfiguration()](#oh_resourcemanager_getconfiguration)和[OH_ResourceManager_GetResourceConfiguration()](#oh_resourcemanager_getresourceconfiguration)方法申请的内存。 | 49| [ResourceManager_ErrorCode OH_ResourceManager_GetString(const NativeResourceManager *mgr, uint32_t resId,char **resultValue, ...)](#oh_resourcemanager_getstring) | 通过指定资源ID,获取对应的string资源。获取普通string资源使用OH_ResourceManager_GetString(mgr, resId, resultValue)接口。获取带有%d、%s、%f占位符的格式化资源使用OH_ResourceManager_GetString(mgr, resId, resultValue, 10, "format", 10.10)接口。使用此接口后,需要调用free()方法来释放字符串的内存。 | 50| [ResourceManager_ErrorCode OH_ResourceManager_GetStringByName(const NativeResourceManager *mgr, const char *resName,char **resultValue, ...)](#oh_resourcemanager_getstringbyname) | 通过指定资源名称,获取对应的string资源。获取普通string资源使用OH_ResourceManager_GetString(mgr, resName, resultValue)接口。获取带有%d、%s、%f占位符的格式化资源使用OH_ResourceManager_GetString(mgr, resName, resultValue, 10, "format", 10.10)接口。使用此接口后,需要调用free()方法来释放字符串的内存。 | 51| [ResourceManager_ErrorCode OH_ResourceManager_GetStringArray(const NativeResourceManager *mgr, uint32_t resId,char ***resultValue, uint32_t *resultLen)](#oh_resourcemanager_getstringarray) | 通过指定资源ID,获取字符串数组。使用此接口后,需要调用[OH_ResourceManager_ReleaseStringArray()](#oh_resourcemanager_releasestringarray)接口来释放字符串数组内存。 | 52| [ResourceManager_ErrorCode OH_ResourceManager_GetStringArrayByName(const NativeResourceManager *mgr,const char *resName, char ***resultValue, uint32_t *resultLen)](#oh_resourcemanager_getstringarraybyname) | 通过指定资源名称,获取字符串数组。使用此接口后,需要调用[OH_ResourceManager_ReleaseStringArray()](#oh_resourcemanager_releasestringarray)接口来释放字符串数组内存。 | 53| [ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray(char ***resValue, uint32_t len)](#oh_resourcemanager_releasestringarray) | 释放字符串数组内存。 | 54| [ResourceManager_ErrorCode OH_ResourceManager_GetPluralString(const NativeResourceManager *mgr, uint32_t resId,uint32_t num, char **resultValue)](#oh_resourcemanager_getpluralstring) | 通过指定资源ID,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 | 55| [ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName(const NativeResourceManager *mgr,const char *resName, uint32_t num, char **resultValue)](#oh_resourcemanager_getpluralstringbyname) | 通过指定资源名称,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 | 56| [ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralString(const NativeResourceManager *mgr, uint32_t resId,uint32_t num, char **resultValue, ...)](#oh_resourcemanager_getintpluralstring) | 通过指定资源ID,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 | 57| [ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralString(const NativeResourceManager *mgr, uint32_t resId,double num, char **resultValue, ...)](#oh_resourcemanager_getdoublepluralstring) | 通过指定资源ID,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 | 58| [ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralStringByName(const NativeResourceManager *mgr,const char *resName, uint32_t num, char **resultValue, ...)](#oh_resourcemanager_getintpluralstringbyname) | 通过指定资源名称,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 | 59| [ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralStringByName(const NativeResourceManager *mgr,const char *resName, double num, char **resultValue, ...)](#oh_resourcemanager_getdoublepluralstringbyname) | 通过指定资源名称,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 | 60| [ResourceManager_ErrorCode OH_ResourceManager_GetColor(const NativeResourceManager *mgr, uint32_t resId,uint32_t *resultValue)](#oh_resourcemanager_getcolor) | 通过指定资源ID,获取对应的颜色值。 | 61| [ResourceManager_ErrorCode OH_ResourceManager_GetColorByName(const NativeResourceManager *mgr, const char *resName,uint32_t *resultValue)](#oh_resourcemanager_getcolorbyname) | 通过指定资源ID,获取对应的颜色值。 | 62| [ResourceManager_ErrorCode OH_ResourceManager_GetInt(const NativeResourceManager *mgr, uint32_t resId,int *resultValue)](#oh_resourcemanager_getint) | 通过指定资源ID,获取对应的int值。 | 63| [ResourceManager_ErrorCode OH_ResourceManager_GetIntByName(const NativeResourceManager *mgr, const char *resName,int *resultValue)](#oh_resourcemanager_getintbyname) | 通过指定资源名称,获取对应的int值。 | 64| [ResourceManager_ErrorCode OH_ResourceManager_GetFloat(const NativeResourceManager *mgr, uint32_t resId,float *resultValue)](#oh_resourcemanager_getfloat) | 通过指定资源ID,获取对应的float值。 | 65| [ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName(const NativeResourceManager *mgr, const char *resName,float *resultValue)](#oh_resourcemanager_getfloatbyname) | 通过指定资源名称,获取对应的float值。 | 66| [ResourceManager_ErrorCode OH_ResourceManager_GetBool(const NativeResourceManager *mgr, uint32_t resId,bool *resultValue)](#oh_resourcemanager_getbool) | 通过指定资源ID,获取对应的bool值。 | 67| [ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName(const NativeResourceManager *mgr, const char *resName,bool *resultValue)](#oh_resourcemanager_getboolbyname) | 通过指定资源名称,获取对应的bool值。 | 68| [ResourceManager_ErrorCode OH_ResourceManager_AddResource(const NativeResourceManager *mgr, const char *path)](#oh_resourcemanager_addresource) | 在应用程序运行时添加overlay资源。 | 69| [ResourceManager_ErrorCode OH_ResourceManager_RemoveResource(const NativeResourceManager *mgr, const char *path)](#oh_resourcemanager_removeresource) | 在应用程序运行时删除overlay资源。 | 70 71## 函数说明 72 73### OH_ResourceManager_GetMediaBase64() 74 75``` 76ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64(const NativeResourceManager *mgr, uint32_t resId,char **resultValue, uint64_t *resultLen, uint32_t density = 0) 77``` 78 79**描述** 80 81通过指定资源ID,获取屏幕密度对应的media资源的Base64码。 82 83**起始版本:** 12 84 85 86**参数:** 87 88| 参数项 | 描述 | 89| -- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 90| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 91| uint32_t resId | 资源ID。 | 92| uint32_t density = 0 | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),默认值为0,表示使用当前系统dpi的密度。 | 93| char **resultValue | 写入resultValue的结果。 | 94| uint64_t *resultLen | 写入resultLen的media长度。 | 95 96**返回:** 97 98| 类型 | 说明 | 99| -- | -- | 100| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 101 102### OH_ResourceManager_GetMediaBase64Data() 103 104``` 105ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64Data(const NativeResourceManager *mgr, uint32_t resId,char **resultValue, uint64_t *resultLen, uint32_t density) 106``` 107 108**描述** 109 110通过指定资源ID,获取屏幕密度对应的media资源的Base64码。 111 112**起始版本:** 12 113 114 115**参数:** 116 117| 参数项 | 描述 | 118| -- | -- | 119| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 120| uint32_t resId | 资源ID。 | 121| char **resultValue | 写入resultValue的结果。 | 122| uint64_t *resultLen | 写入resultLen的media长度。 | 123| uint32_t density | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 | 124 125**返回:** 126 127| 类型 | 说明 | 128| -- | -- | 129| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 130 131### OH_ResourceManager_GetMediaBase64ByName() 132 133``` 134ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName(const NativeResourceManager *mgr,const char *resName, char **resultValue, uint64_t *resultLen, uint32_t density = 0) 135``` 136 137**描述** 138 139通过指定资源名称,获取屏幕密度对应的media资源的Base64码。 140 141**起始版本:** 12 142 143 144**参数:** 145 146| 参数项 | 描述 | 147| -- | -- | 148| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 149| const char *resName | 资源名称。 | 150| char **resultValue | 写入resultValue的结果。 | 151| uint64_t *resultLen | 写入resultLen的media长度。 | 152| uint32_t density = 0 | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),默认值为0,表示使用当前系统dpi的密度。 | 153 154**返回:** 155 156| 类型 | 说明 | 157| -- | -- | 158| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_NAME_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 159 160### OH_ResourceManager_GetMediaBase64DataByName() 161 162``` 163ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64DataByName(const NativeResourceManager *mgr,const char *resName, char **resultValue, uint64_t *resultLen, uint32_t density) 164``` 165 166**描述** 167 168通过指定资源名称,获取屏幕密度对应的media资源的Base64码。 169 170**起始版本:** 12 171 172 173**参数:** 174 175| 参数项 | 描述 | 176| -- | -- | 177| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 178| const char *resName | 资源名称。 | 179| char **resultValue | 写入resultValue的结果。 | 180| uint64_t *resultLen | 写入resultLen的media长度。 | 181| uint32_t density | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 | 182 183**返回:** 184 185| 类型 | 说明 | 186| -- | -- | 187| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_NAME_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 188 189### OH_ResourceManager_GetMedia() 190 191``` 192ResourceManager_ErrorCode OH_ResourceManager_GetMedia(const NativeResourceManager *mgr, uint32_t resId,uint8_t **resultValue, uint64_t *resultLen, uint32_t density = 0) 193``` 194 195**描述** 196 197通过指定资源ID,获取屏幕密度对应的media资源的内容。 198 199**起始版本:** 12 200 201 202**参数:** 203 204| 参数项 | 描述 | 205| -- | -- | 206| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 207| uint32_t resId | 资源ID。 | 208| uint32_t density = 0 | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),默认值为0,表示使用当前系统dpi的密度。 | 209| uint8_t **resultValue | 写入resultValue的结果。 | 210| uint64_t *resultLen | 写入resultLen的media长度。 | 211 212**返回:** 213 214| 类型 | 说明 | 215| -- | -- | 216| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 217 218### OH_ResourceManager_GetMediaData() 219 220``` 221ResourceManager_ErrorCode OH_ResourceManager_GetMediaData(const NativeResourceManager *mgr, uint32_t resId,uint8_t **resultValue, uint64_t *resultLen, uint32_t density) 222``` 223 224**描述** 225 226通过指定资源ID,获取屏幕密度对应的media资源的内容。 227 228**起始版本:** 12 229 230 231**参数:** 232 233| 参数项 | 描述 | 234| -- | -- | 235| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 236| uint32_t resId | 资源ID。 | 237| uint8_t **resultValue | 写入resultValue的结果。 | 238| uint64_t *resultLen | 写入resultLen的media长度。 | 239| uint32_t density | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 | 240 241**返回:** 242 243| 类型 | 说明 | 244| -- | -- | 245| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 246 247### OH_ResourceManager_GetMediaByName() 248 249``` 250ResourceManager_ErrorCode OH_ResourceManager_GetMediaByName(const NativeResourceManager *mgr, const char *resName,uint8_t **resultValue, uint64_t *resultLen, uint32_t density = 0) 251``` 252 253**描述** 254 255通过指定资源名称,获取屏幕密度对应的media资源的内容。 256 257**起始版本:** 12 258 259 260**参数:** 261 262| 参数项 | 描述 | 263| -- | -- | 264| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 265| const char *resName | 资源名称。 | 266| uint32_t density = 0 | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),默认值为0,表示使用当前系统dpi的密度。 | 267| uint8_t **resultValue | 写入resultValue的结果。 | 268| uint64_t *resultLen | 写入resultLen的media长度。 | 269 270**返回:** 271 272| 类型 | 说明 | 273| -- | -- | 274| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_NAME_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 275 276### OH_ResourceManager_GetMediaDataByName() 277 278``` 279ResourceManager_ErrorCode OH_ResourceManager_GetMediaDataByName(const NativeResourceManager *mgr, const char *resName,uint8_t **resultValue, uint64_t *resultLen, uint32_t density) 280``` 281 282**描述** 283 284通过指定资源名称,获取屏幕密度对应的media资源的内容。 285 286**起始版本:** 12 287 288 289**参数:** 290 291| 参数项 | 描述 | 292| -- | -- | 293| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 294| const char *resName | 资源名称。 | 295| uint8_t **resultValue | 写入resultValue的结果。 | 296| uint64_t *resultLen | 写入resultLen的media长度。 | 297| uint32_t density | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 | 298 299**返回:** 300 301| 类型 | 说明 | 302| -- | -- | 303| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_NAME_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 304 305### OH_ResourceManager_GetDrawableDescriptor() 306 307``` 308ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor(const NativeResourceManager *mgr,uint32_t resId, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0) 309``` 310 311**描述** 312 313通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。 314 315**起始版本:** 12 316 317 318**参数:** 319 320| 参数项 | 描述 | 321|---------------------------------------------------------------------------------------------------------------------| -- | 322| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 323| uint32_t resId | 资源ID。 | 324| uint32_t density = 0 | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),默认值为0,表示使用当前系统dpi的密度。 | 325| uint32_t type = 0 | 可选参数,表示图标类型,0表示自身图标,1表示主题图标。 | 326| [ArkUI_DrawableDescriptor](../apis-arkui/capi-arkui-nativemodule-arkui-drawabledescriptor.md) **drawableDescriptor | 写入drawableDescriptor的结果。 | 327 328**返回:** 329 330| 类型 | 说明 | 331| -- | -- | 332| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。 | 333 334### OH_ResourceManager_GetDrawableDescriptorData() 335 336``` 337ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorData(const NativeResourceManager *mgr,uint32_t resId, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density, uint32_t type) 338``` 339 340**描述** 341 342通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。 343 344**起始版本:** 12 345 346 347**参数:** 348 349| 参数项 | 描述 | 350| -- | -- | 351| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 352| uint32_t resId | 资源ID。 | 353| [ArkUI_DrawableDescriptor](../apis-arkui/capi-arkui-nativemodule-arkui-drawabledescriptor.md) **drawableDescriptor | 写入drawableDescriptor的结果。 | 354| uint32_t density | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 | 355| uint32_t type | 可选参数,表示图标类型,0表示自身图标,1表示主题图标。如果该属性不是必需的,请将该参数设为0。 | 356 357**返回:** 358 359| 类型 | 说明 | 360| -- | -- | 361| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。 | 362 363### OH_ResourceManager_GetDrawableDescriptorByName() 364 365``` 366ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName(const NativeResourceManager *mgr,const char *resName, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0) 367``` 368 369**描述** 370 371通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。 372 373**起始版本:** 12 374 375 376**参数:** 377 378| 参数项 | 描述 | 379| -- | -- | 380| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 381| const char *resName | 资源名称。 | 382| uint32_t density = 0 | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),默认值为0,表示使用当前系统dpi的密度。 | 383| uint32_t type = 0 | 可选参数,表示图标类型,0表示自身图标,1表示主题图标,2表示动态图标。 | 384| [ArkUI_DrawableDescriptor](../apis-arkui/capi-arkui-nativemodule-arkui-drawabledescriptor.md) **drawableDescriptor | 写入drawableDescriptor的结果。 | 385 386**返回:** 387 388| 类型 | 说明 | 389| -- | -- | 390| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_NAME_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。 | 391 392### OH_ResourceManager_GetDrawableDescriptorDataByName() 393 394``` 395ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorDataByName(const NativeResourceManager *mgr,const char *resName, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density, uint32_t type) 396``` 397 398**描述** 399 400通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。 401 402**起始版本:** 12 403 404 405**参数:** 406 407| 参数项 | 描述 | 408| -- | -- | 409| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 410| const char *resName | 资源名称。 | 411| [ArkUI_DrawableDescriptor](../apis-arkui/capi-arkui-nativemodule-arkui-drawabledescriptor.md) **drawableDescriptor | 写入drawableDescriptor的结果。 | 412| uint32_t density | 可选参数,取值范围参考[ScreenDensity](capi-resmgr-common-h.md#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 | 413| uint32_t type | 可选参数,表示图标类型,0表示自身图标,1表示主题图标。如果该属性不是必需的,请将该参数设为0。 | 414 415**返回:** 416 417| 类型 | 说明 | 418| -- | -- | 419| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_NAME_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。 | 420 421### OH_ResourceManager_GetSymbol() 422 423``` 424ResourceManager_ErrorCode OH_ResourceManager_GetSymbol(const NativeResourceManager *mgr, uint32_t resId,uint32_t *resultValue) 425``` 426 427**描述** 428 429通过指定资源ID,获取对应的symbol资源。 430 431**起始版本:** 12 432 433 434**参数:** 435 436| 参数项 | 描述 | 437| -- | -- | 438| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 439| uint32_t resId | 资源ID。 | 440| uint32_t *resultValue | 写入resultValue的结果。 | 441 442**返回:** 443 444| 类型 | 说明 | 445| -- | -- | 446| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 447 448### OH_ResourceManager_GetSymbolByName() 449 450``` 451ResourceManager_ErrorCode OH_ResourceManager_GetSymbolByName(const NativeResourceManager *mgr, const char *resName,uint32_t *resultValue) 452``` 453 454**描述** 455 456通过指定资源名称,获取对应的symbol资源。 457 458**起始版本:** 12 459 460 461**参数:** 462 463| 参数项 | 描述 | 464| -- | -- | 465| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 466| const char *resName | 资源名称。 | 467| uint32_t *resultValue | 写入resultValue的结果。 | 468 469**返回:** 470 471| 类型 | 说明 | 472| -- | -- | 473| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_NAME_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 474 475### OH_ResourceManager_GetLocales() 476 477``` 478ResourceManager_ErrorCode OH_ResourceManager_GetLocales(const NativeResourceManager *mgr, char ***resultValue,uint32_t *resultLen, bool includeSystem = false) 479``` 480 481**描述** 482 483获取语言列表。使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()方法来释放localinfo的内存。 484 485**起始版本:** 12 486 487 488**参数:** 489 490| 参数项 | 描述 | 491| -- | -- | 492| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 493| char ***resultValue | 写入resultValue的结果。 | 494| uint32_t *resultLen | 写入resultLen的locales长度。 | 495| bool includeSystem = false | 是否包含系统资源,默认值为false,当只有系统资源查询locales列表时它不起作用。 | 496 497**返回:** 498 499| 类型 | 说明 | 500| -- | -- | 501| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 502 503### OH_ResourceManager_GetLocalesData() 504 505``` 506ResourceManager_ErrorCode OH_ResourceManager_GetLocalesData(const NativeResourceManager *mgr, char ***resultValue,uint32_t *resultLen, bool includeSystem) 507``` 508 509**描述** 510 511获取语言列表。使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()方法来释放localinfo的内存。 512 513**起始版本:** 12 514 515 516**参数:** 517 518| 参数项 | 描述 | 519| -- | -- | 520| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 521| char ***resultValue | 写入resultValue的结果。 | 522| uint32_t *resultLen | 写入resultLen的locales长度。 | 523| bool includeSystem | 是否包含系统资源,如果不需要此属性,请将此参数设置为 false。 | 524 525**返回:** 526 527| 类型 | 说明 | 528| -- | -- | 529| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 530 531### OH_ResourceManager_GetConfiguration() 532 533``` 534ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration(const NativeResourceManager *mgr,ResourceManager_Configuration *configuration) 535``` 536 537**描述** 538 539获取设备配置。使用此接口后,需要调用OH_ResourceManager_ReleaseConfiguration()方法来释放内存。如果使用malloc创建ResourceManager_Configuration对象,还需要调用free()方法来释放它。 540 541**起始版本:** 12 542 543**废弃版本:** 20 544 545**替代接口:** [OH_ResourceManager_GetResourceConfiguration](#oh_resourcemanager_getresourceconfiguration) 546 547 548**参数:** 549 550| 参数项 | 描述 | 551| -- | -- | 552| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 553| [ResourceManager_Configuration](capi-resourcemanager-resourcemanager-configuration.md) *configuration | 写入获取的设备配置。其中configuration.screenDensity的返回值为设备DPI除以160取整后的值。 | 554 555**返回:** 556 557| 类型 | 说明 | 558| -- | -- | 559| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001009 - 无法访问系统资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 560 561### OH_ResourceManager_GetResourceConfiguration() 562 563``` 564ResourceManager_ErrorCode OH_ResourceManager_GetResourceConfiguration(const NativeResourceManager *mgr,ResourceManager_Configuration *configuration) 565``` 566 567**描述** 568 569获取设备配置。使用此接口后,需要调用OH_ResourceManager_ReleaseConfiguration()方法来释放内存。如果使用malloc创建ResourceManager_Configuration对象,还需要调用free()方法来释放它。 570 571**起始版本:** 20 572 573 574**参数:** 575 576| 参数项 | 描述 | 577| -- | -- | 578| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 579| [ResourceManager_Configuration](capi-resourcemanager-resourcemanager-configuration.md) *configuration | 写入获取的设备配置。其中configuration.screenDensity的返回值为设备DPI。 | 580 581**返回:** 582 583| 类型 | 说明 | 584| -- | -- | 585| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001009 - 无法访问系统资源。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 586 587### OH_ResourceManager_ReleaseConfiguration() 588 589``` 590ResourceManager_ErrorCode OH_ResourceManager_ReleaseConfiguration(ResourceManager_Configuration *configuration) 591``` 592 593**描述** 594 595释放OH_ResourceManager_GetConfiguration()方法申请的内存。 596 597**起始版本:** 12 598 599 600**参数:** 601 602| 参数项 | 描述 | 603| -- | -- | 604| [ResourceManager_Configuration](capi-resourcemanager-resourcemanager-configuration.md) *configuration | 需要释放内存的configuration对象。 | 605 606**返回:** 607 608| 类型 | 说明 | 609| -- | -- | 610| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。 | 611 612### OH_ResourceManager_GetString() 613 614``` 615ResourceManager_ErrorCode OH_ResourceManager_GetString(const NativeResourceManager *mgr, uint32_t resId,char **resultValue, ...) 616``` 617 618**描述** 619 620通过指定资源ID,获取对应的string资源。获取普通string资源使用OH_ResourceManager_GetString(mgr, resId, resultValue)接口。获取带有%d、%s、%f占位符的格式化资源使用OH_ResourceManager_GetString(mgr, resId, resultValue, 10, "format", 10.10)接口。使用此接口后,需要调用free()方法来释放字符串的内存。 621 622**起始版本:** 12 623 624 625**参数:** 626 627| 参数项 | 描述 | 628|-------------------------------------------------------------------------------------------------| -- | 629| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 630| uint32_t resId | 资源ID。 | 631| char **resultValue | 写入resultValue的结果。 | 632| ... | 格式化字符串资源参数,可变参数,支持const char*、int、float类型。 | 633 634**返回:** 635 636| 类型 | 说明 | 637| -- | -- | 638| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 639 640### OH_ResourceManager_GetStringByName() 641 642``` 643ResourceManager_ErrorCode OH_ResourceManager_GetStringByName(const NativeResourceManager *mgr, const char *resName,char **resultValue, ...) 644``` 645 646**描述** 647 648通过指定资源名称,获取对应的string资源。获取普通string资源使用OH_ResourceManager_GetString(mgr, resName, resultValue)接口。获取带有%d、%s、%f占位符的格式化资源使用OH_ResourceManager_GetString(mgr, resName, resultValue, 10, "format", 10.10)接口。使用此接口后,需要调用free()方法来释放字符串的内存。 649 650**起始版本:** 12 651 652 653**参数:** 654 655| 参数项 | 描述 | 656| -- | -- | 657| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向 [NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 658| const char *resName | 资源名称。 | 659| char **resultValue | 写入resultValue的结果。 | 660| ... | 格式化字符串资源参数,可变参数,支持const char*、int、float类型。 | 661 662**返回:** 663 664| 类型 | 说明 | 665| -- | -- | 666| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 667 668### OH_ResourceManager_GetStringArray() 669 670``` 671ResourceManager_ErrorCode OH_ResourceManager_GetStringArray(const NativeResourceManager *mgr, uint32_t resId,char ***resultValue, uint32_t *resultLen) 672``` 673 674**描述** 675 676通过指定资源ID,获取字符串数组。使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()接口来释放字符串数组内存。 677 678**起始版本:** 12 679 680 681**参数:** 682 683| 参数项 | 描述 | 684|--------------------------------------| -- | 685| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 686| uint32_t resId | 资源ID。 | 687| char ***resultValue | 写入resultValue的结果。 | 688| uint32_t *resultLen | 写入resultLen的StringArray长度。 | 689 690**返回:** 691 692| 类型 | 说明 | 693| -- | -- | 694| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 695 696### OH_ResourceManager_GetStringArrayByName() 697 698``` 699ResourceManager_ErrorCode OH_ResourceManager_GetStringArrayByName(const NativeResourceManager *mgr,const char *resName, char ***resultValue, uint32_t *resultLen) 700``` 701 702**描述** 703 704通过指定资源名称,获取字符串数组。使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()接口来释放字符串数组内存。 705 706**起始版本:** 12 707 708 709**参数:** 710 711| 参数项 | 描述 | 712| -- | -- | 713| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 714| const char *resName | 资源名称。 | 715| char ***resultValue | 写入resultValue的结果。 | 716| uint32_t *resultLen | 写入resultLen的StringArray长度。 | 717 718**返回:** 719 720| 类型 | 说明 | 721| -- | -- | 722| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 723 724### OH_ResourceManager_ReleaseStringArray() 725 726``` 727ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray(char ***resValue, uint32_t len) 728``` 729 730**描述** 731 732释放字符串数组内存。 733 734**起始版本:** 12 735 736 737**参数:** 738 739| 参数项 | 描述 | 740| -- | -- | 741| char ***resValue | 需要释放的字符串数组。 | 742| uint32_t len | 字符串数组长度。 | 743 744**返回:** 745 746| 类型 | 说明 | 747| -- | -- | 748| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。 | 749 750### OH_ResourceManager_GetPluralString() 751 752``` 753ResourceManager_ErrorCode OH_ResourceManager_GetPluralString(const NativeResourceManager *mgr, uint32_t resId,uint32_t num, char **resultValue) 754``` 755 756**描述** 757 758通过指定资源ID,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 759 760**起始版本:** 12 761 762**废弃版本:** 18 763 764**替代接口:** [OH_ResourceManager_GetIntPluralString](capi-ohresmgr-h.md#oh_resourcemanager_getintpluralstring) 765 766 767**参数:** 768 769| 参数项 | 描述 | 770|--------------------------------------| -- | 771| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 772| uint32_t resId | 资源ID。 | 773| uint32_t num | 数量值。 | 774| char **resultValue | 写入resultValue的结果。 | 775 776**返回:** 777 778| 类型 | 说明 | 779| -- | -- | 780| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 781 782### OH_ResourceManager_GetPluralStringByName() 783 784``` 785ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName(const NativeResourceManager *mgr,const char *resName, uint32_t num, char **resultValue) 786``` 787 788**描述** 789 790通过指定资源名称,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 791 792**起始版本:** 12 793 794**废弃版本:** 18 795 796**替代接口:** [OH_ResourceManager_GetIntPluralStringByName](capi-ohresmgr-h.md#oh_resourcemanager_getintpluralstringbyname) 797 798 799**参数:** 800 801| 参数项 | 描述 | 802| -- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 803| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 804| const char *resName | 资源名称。 | 805| uint32_t num | 数量值。 | 806| char **resultValue | 写入resultValue的结果。 | 807 808**返回:** 809 810| 类型 | 说明 | 811| -- | -- | 812| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 813 814### OH_ResourceManager_GetIntPluralString() 815 816``` 817ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralString(const NativeResourceManager *mgr, uint32_t resId,uint32_t num, char **resultValue, ...) 818``` 819 820**描述** 821 822通过指定资源ID,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 823 824**起始版本:** 18 825 826 827**参数:** 828 829| 参数项 | 描述 | 830| -- | -- | 831| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 832| uint32_t resId | 资源ID。 | 833| uint32_t num | 数量值(整数)。根据当前语言的复数规则获取该数量值对应的字符串数字。 | 834| char **resultValue | 写入resultValue的结果。 | 835| ... | 格式化字符串资源参数,可变参数,支持const char*、int、float类型。 | 836 837**返回:** 838 839| 类型 | 说明 | 840| -- | -- | 841| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 842 843### OH_ResourceManager_GetDoublePluralString() 844 845``` 846ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralString(const NativeResourceManager *mgr, uint32_t resId,double num, char **resultValue, ...) 847``` 848 849**描述** 850 851通过指定资源ID,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 852 853**起始版本:** 18 854 855 856**参数:** 857 858| 参数项 | 描述 | 859| -- | -- | 860| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 861| uint32_t resId | 资源ID。 | 862| double num | 数量值(浮点数)。根据当前语言的复数规则获取该数量值对应的字符串数字。 | 863| char **resultValue | 写入resultValue的结果。 | 864| ... | 格式化字符串资源参数,可变参数,支持const char*、int、float类型。 | 865 866**返回:** 867 868| 类型 | 说明 | 869| -- | -- | 870| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 871 872### OH_ResourceManager_GetIntPluralStringByName() 873 874``` 875ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralStringByName(const NativeResourceManager *mgr,const char *resName, uint32_t num, char **resultValue, ...) 876``` 877 878**描述** 879 880通过指定资源名称,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 881 882**起始版本:** 18 883 884 885**参数:** 886 887| 参数项 | 描述 | 888|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 889| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 890| const char *resName | 资源名称。 | 891| uint32_t num | 数量值(整数)。根据当前语言的复数规则获取该数量值对应的字符串数字。 | 892| char **resultValue | 写入resultValue的结果。 | 893| ... | 格式化字符串资源参数,可变参数,支持const char*、int、float类型。 | 894 895**返回:** 896 897| 类型 | 说明 | 898| -- | -- | 899| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 900 901### OH_ResourceManager_GetDoublePluralStringByName() 902 903``` 904ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralStringByName(const NativeResourceManager *mgr,const char *resName, double num, char **resultValue, ...) 905``` 906 907**描述** 908 909通过指定资源名称,获取对应的单复数字符串。使用此接口后,需要调用free()方法来释放字符串的内存。 910 911**起始版本:** 18 912 913 914**参数:** 915 916| 参数项 | 描述 | 917| -- | -- | 918| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 919| const char *resName | 资源名称。 | 920| double num | 数量值(浮点数)。根据当前语言的复数规则获取该数量值对应的字符串数字。 | 921| char **resultValue | 写入resultValue的结果。 | 922| ... | 格式化字符串资源参数,可变参数,支持const char*、int、float类型。 | 923 924**返回:** 925 926| 类型 | 说明 | 927| -- | -- | 928| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。<br> [ERROR_CODE_OUT_OF_MEMORY](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001100 - 内存溢出。 | 929 930### OH_ResourceManager_GetColor() 931 932``` 933ResourceManager_ErrorCode OH_ResourceManager_GetColor(const NativeResourceManager *mgr, uint32_t resId,uint32_t *resultValue) 934``` 935 936**描述** 937 938通过指定资源ID,获取对应的颜色值。 939 940**起始版本:** 12 941 942 943**参数:** 944 945| 参数项 | 描述 | 946| -- | -- | 947| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 948| uint32_t resId | 资源ID。 | 949| uint32_t *resultValue | 写入resultValue的结果。 | 950 951**返回:** 952 953| 类型 | 说明 | 954| -- | -- | 955| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 956 957### OH_ResourceManager_GetColorByName() 958 959``` 960ResourceManager_ErrorCode OH_ResourceManager_GetColorByName(const NativeResourceManager *mgr, const char *resName,uint32_t *resultValue) 961``` 962 963**描述** 964 965通过指定资源ID,获取对应的颜色值。 966 967**起始版本:** 12 968 969 970**参数:** 971 972| 参数项 | 描述 | 973| -- | -- | 974| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 975| const char *resName | 资源名称。 | 976| uint32_t *resultValue | 写入resultValue的结果。 | 977 978**返回:** 979 980| 类型 | 说明 | 981| -- | -- | 982| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 983 984### OH_ResourceManager_GetInt() 985 986``` 987ResourceManager_ErrorCode OH_ResourceManager_GetInt(const NativeResourceManager *mgr, uint32_t resId,int *resultValue) 988``` 989 990**描述** 991 992通过指定资源ID,获取对应的int值。 993 994**起始版本:** 12 995 996 997**参数:** 998 999| 参数项 | 描述 | 1000| -- | -- | 1001| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1002| uint32_t resId | 资源ID。 | 1003| int *resultValue | 写入resultValue的结果。 | 1004 1005**返回:** 1006 1007| 类型 | 说明 | 1008| -- | -- | 1009| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 1010 1011### OH_ResourceManager_GetIntByName() 1012 1013``` 1014ResourceManager_ErrorCode OH_ResourceManager_GetIntByName(const NativeResourceManager *mgr, const char *resName,int *resultValue) 1015``` 1016 1017**描述** 1018 1019通过指定资源名称,获取对应的int值。 1020 1021**起始版本:** 12 1022 1023 1024**参数:** 1025 1026| 参数项 | 描述 | 1027| -- | -- | 1028| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1029| const char *resName | 资源名称。 | 1030| int *resultValue | 写入resultValue的结果。 | 1031 1032**返回:** 1033 1034| 类型 | 说明 | 1035| -- | -- | 1036| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 1037 1038### OH_ResourceManager_GetFloat() 1039 1040``` 1041ResourceManager_ErrorCode OH_ResourceManager_GetFloat(const NativeResourceManager *mgr, uint32_t resId,float *resultValue) 1042``` 1043 1044**描述** 1045 1046通过指定资源ID,获取对应的float值。 1047 1048**起始版本:** 12 1049 1050 1051**参数:** 1052 1053| 参数项 | 描述 | 1054| -- | -- | 1055| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1056| uint32_t resId | 资源ID。 | 1057| float *resultValue | 写入resultValue的结果。 | 1058 1059**返回:** 1060 1061| 类型 | 说明 | 1062| -- | -- | 1063| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 1064 1065### OH_ResourceManager_GetFloatByName() 1066 1067``` 1068ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName(const NativeResourceManager *mgr, const char *resName,float *resultValue) 1069``` 1070 1071**描述** 1072 1073通过指定资源名称,获取对应的float值。 1074 1075**起始版本:** 12 1076 1077 1078**参数:** 1079 1080| 参数项 | 描述 | 1081| -- | -- | 1082| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1083| const char *resName | 资源名称。 | 1084| float *resultValue | 写入resultValue的结果。 | 1085 1086**返回:** 1087 1088| 类型 | 说明 | 1089| -- | -- | 1090| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 1091 1092### OH_ResourceManager_GetBool() 1093 1094``` 1095ResourceManager_ErrorCode OH_ResourceManager_GetBool(const NativeResourceManager *mgr, uint32_t resId,bool *resultValue) 1096``` 1097 1098**描述** 1099 1100通过指定资源ID,获取对应的bool值。 1101 1102**起始版本:** 12 1103 1104 1105**参数:** 1106 1107| 参数项 | 描述 | 1108| -- | -- | 1109| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1110| uint32_t resId | 资源ID。 | 1111| bool *resultValue | 写入resultValue的结果。 | 1112 1113**返回:** 1114 1115| 类型 | 说明 | 1116| -- | -- | 1117| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001001 - 无效的资源ID。<br> [ERROR_CODE_RES_NOT_FOUND_BY_ID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001002 - 没有根据资源ID找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 1118 1119### OH_ResourceManager_GetBoolByName() 1120 1121``` 1122ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName(const NativeResourceManager *mgr, const char *resName,bool *resultValue) 1123``` 1124 1125**描述** 1126 1127通过指定资源名称,获取对应的bool值。 1128 1129**起始版本:** 12 1130 1131 1132**参数:** 1133 1134| 参数项 | 描述 | 1135| -- | -- | 1136| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1137| const char *resName | 资源名称。 | 1138| bool *resultValue | 写入resultValue的结果。 | 1139 1140**返回:** 1141 1142| 类型 | 说明 | 1143| -- | -- | 1144| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_RES_ID_NOT_FOUND](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001003 - 无效的资源名称。<br> [ERROR_CODE_RES_NOT_FOUND_BY_NAME](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001004 - 没有根据资源名称找到匹配的资源。<br> [ERROR_CODE_RES_REF_TOO_MUCH](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001006 - 资源被循环引用。 | 1145 1146### OH_ResourceManager_AddResource() 1147 1148``` 1149ResourceManager_ErrorCode OH_ResourceManager_AddResource(const NativeResourceManager *mgr, const char *path) 1150``` 1151 1152**描述** 1153 1154在应用程序运行时添加overlay资源。 1155 1156**起始版本:** 12 1157 1158 1159**参数:** 1160 1161| 参数项 | 描述 | 1162| -- | -- | 1163| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1164| const char *path | 资源路径。 | 1165 1166**返回:** 1167 1168| 类型 | 说明 | 1169| -- | -- | 1170| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_OVERLAY_RES_PATH_INVALID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001010 - 无效的资源路径. | 1171 1172### OH_ResourceManager_RemoveResource() 1173 1174``` 1175ResourceManager_ErrorCode OH_ResourceManager_RemoveResource(const NativeResourceManager *mgr, const char *path) 1176``` 1177 1178**描述** 1179 1180在应用程序运行时删除overlay资源。 1181 1182**起始版本:** 12 1183 1184 1185**参数:** 1186 1187| 参数项 | 描述 | 1188| -- | -- | 1189| const [NativeResourceManager](capi-rawfile-nativeresourcemanager.md) *mgr | 指向[NativeResourceManager](capi-rawfile-nativeresourcemanager.md)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](capi-raw-file-manager-h.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 | 1190| const char *path | 资源路径。 | 1191 1192**返回:** 1193 1194| 类型 | 说明 | 1195| -- | -- | 1196| [ResourceManager_ErrorCode](capi-resmgr-common-h.md#resourcemanager_errorcode) | [SUCCESS](capi-resmgr-common-h.md#resourcemanager_errorcode) 0 - 成功。<br> [ERROR_CODE_INVALID_INPUT_PARAMETER](capi-resmgr-common-h.md#resourcemanager_errorcode) 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。<br> [ERROR_CODE_OVERLAY_RES_PATH_INVALID](capi-resmgr-common-h.md#resourcemanager_errorcode) 9001010 - 无效的资源路径. | 1197 1198 1199