• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Resourcemanager
2
3
4## 概述
5
6提供c相关获取资源的接口。
7
8**起始版本:** 12
9
10
11## 汇总
12
13
14### 文件
15
16| 名称 | 描述 |
17| -------- | -------- |
18| [ohresmgr.h](ohresmgr_8h.md) | 提供资源管理native侧获取资源的能力。 |
19| [resmgr_common.h](resmgr__common_8h.md) | 提供接口所需要的枚举类型和结构体。 |
20
21
22### 结构体
23
24| 名称 | 描述 |
25| -------- | -------- |
26| struct  [ResourceManager_Configuration](_resource_manager___configuration.md) | 设备状态的枚举。 |
27
28
29### 类型定义
30
31| 名称 | 描述 |
32| -------- | -------- |
33| typedef enum [ResourceManager_Direction](#resourcemanager_direction) [ResourceManager_Direction](#resourcemanager_direction) | 屏幕方向的枚举。 |
34| typedef enum [ResourceManager_ColorMode](#resourcemanager_colormode) [ResourceManager_ColorMode](#resourcemanager_colormode) | 颜色模式的枚举。 |
35| typedef enum [ResourceManager_DeviceType](#resourcemanager_devicetype) [ResourceManager_DeviceType](#resourcemanager_devicetype) | 设备类型的枚举。 |
36| typedef struct [ResourceManager_Configuration](_resource_manager___configuration.md) [ResourceManager_Configuration](#resourcemanager_configuration) | 设备状态的枚举。 |
37
38
39### 枚举
40
41| 名称 | 描述 |
42| -------- | -------- |
43| [ResourceManager_ErrorCode](#resourcemanager_errorcode) {<br/>SUCCESS = 0, ERROR_CODE_INVALID_INPUT_PARAMETER = 401, ERROR_CODE_RES_ID_NOT_FOUND = 9001001, ERROR_CODE_RES_NOT_FOUND_BY_ID = 9001002,<br/>ERROR_CODE_RES_NAME_NOT_FOUND = 9001003, ERROR_CODE_RES_NOT_FOUND_BY_NAME = 9001004, ERROR_CODE_RES_PATH_INVALID = 9001005, ERROR_CODE_RES_REF_TOO_MUCH = 9001006,<br/>ERROR_CODE_RES_ID_FORMAT_ERROR = 9001007, ERROR_CODE_RES_NAME_FORMAT_ERROR = 9001008, ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED = 9001009, ERROR_CODE_OVERLAY_RES_PATH_INVALID = 9001010,<br/>ERROR_CODE_OUT_OF_MEMORY = 9001100<br/>} | 资源管理错误码。 |
44| [ScreenDensity](#screendensity) {<br/>SCREEN_SDPI = 120, SCREEN_MDPI = 160, SCREEN_LDPI = 240, SCREEN_XLDPI = 320,<br/>SCREEN_XXLDPI = 480, SCREEN_XXXLDPI = 640<br/>} | 屏幕密度类型的枚举。 |
45| [ResourceManager_Direction](#resourcemanager_direction) { DIRECTION_VERTICAL = 0, DIRECTION_HORIZONTAL = 1 } | 屏幕方向的枚举。 |
46| [ResourceManager_ColorMode](#resourcemanager_colormode) { DARK = 0, LIGHT = 1 } | 颜色模式的枚举。 |
47| [ResourceManager_DeviceType](#resourcemanager_devicetype) {<br/>DEVICE_TYPE_PHONE = 0X00, DEVICE_TYPE_TABLET = 0x01, DEVICE_TYPE_CAR = 0x02, DEVICE_TYPE_PC = 0x03,<br/>DEVICE_TYPE_TV = 0x04, DEVICE_TYPE_WEARABLE = 0x06, DEVICE_TYPE_2IN1 = 0x07<br/>} | 设备类型的枚举。 |
48
49
50### 函数
51
52| 名称 | 描述 |
53| -------- | -------- |
54| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64](#oh_resourcemanager_getmediabase64) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | 通过指定资源ID,获取屏幕密度对应的media资源的Base64码。 |
55| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64Data](#oh_resourcemanager_getmediabase64data) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*resultValue, uint64_t \*resultLen, uint32_t density) | 通过指定资源ID,获取屏幕密度对应的media资源的Base64码。 |
56| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64ByName](#oh_resourcemanager_getmediabase64byname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | 通过指定资源名称,获取屏幕密度对应的media资源的Base64码。 |
57| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64DataByName](#oh_resourcemanager_getmediabase64databyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*resultValue, uint64_t \*resultLen, uint32_t density) | 通过指定资源名称,获取屏幕密度对应的media资源的Base64码。 |
58| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMedia](#oh_resourcemanager_getmedia) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | 通过指定资源ID,获取屏幕密度对应的media资源的内容。 |
59| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaData](#oh_resourcemanager_getmediadata) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density) | 通过指定资源ID,获取屏幕密度对应的media资源的内容。 |
60| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaByName](#oh_resourcemanager_getmediabyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | 通过指定资源名称,获取屏幕密度对应的media资源的内容。 |
61| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaDataByName](#oh_resourcemanager_getmediadatabyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density) | 通过指定资源名称,获取屏幕密度对应的media资源的内容。 |
62| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptor](#oh_resourcemanager_getdrawabledescriptor) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density=0, uint32_t type=0) | 通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。 |
63| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptorData](#oh_resourcemanager_getdrawabledescriptordata) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type) | 通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。 |
64| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptorByName](#oh_resourcemanager_getdrawabledescriptorbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density=0, uint32_t type=0) | 通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。 |
65| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptorDataByName](#oh_resourcemanager_getdrawabledescriptordatabyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type) | 通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。 |
66| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetSymbol](#oh_resourcemanager_getsymbol) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t \*resultValue) | 通过指定资源ID,获取对应的symbol资源。 |
67| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetSymbolByName](#oh_resourcemanager_getsymbolbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t \*resultValue) | 通过指定资源名称,获取对应的symbol资源。 |
68| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetLocales](#oh_resourcemanager_getlocales) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, char \*\*\*resultValue, uint32_t \*resultLen, bool includeSystem=false) | 获取语言列表。 |
69| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetLocalesData](#oh_resourcemanager_getlocalesdata) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, char \*\*\*resultValue, uint32_t \*resultLen, bool includeSystem) | 获取语言列表。 |
70| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetConfiguration](#oh_resourcemanager_getconfiguration) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, [ResourceManager_Configuration](_resource_manager___configuration.md) \*configuration) | 获取设备配置。 |
71| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_ReleaseConfiguration](#oh_resourcemanager_releaseconfiguration) ([ResourceManager_Configuration](_resource_manager___configuration.md) \*configuration) | 释放OH_ResourceManager_GetConfiguration()方法申请的内存。 |
72| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetString](#oh_resourcemanager_getstring) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*resultValue,...) | 通过指定资源ID,获取对应的string资源。 |
73| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetStringByName](#oh_resourcemanager_getstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*resultValue,...) | 通过指定资源名称,获取对应的string资源。 |
74| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetStringArray](#oh_resourcemanager_getstringarray) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*\*resultValue, uint32_t \*resultLen) | 通过指定资源ID,获取字符串数组。 |
75| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetStringArrayByName](#oh_resourcemanager_getstringarraybyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*\*resultValue, uint32_t \*resultLen) | 通过指定资源名称,获取字符串数组。 |
76| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_ReleaseStringArray](#oh_resourcemanager_releasestringarray) (char \*\*\*resValue, uint32_t len) | 释放字符串数组内存。 |
77| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetPluralString](#oh_resourcemanager_getpluralstring) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t num, char \*\*resultValue) | 通过指定资源ID,获取对应的单复数字符串。 |
78| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetPluralStringByName](#oh_resourcemanager_getpluralstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t num, char \*\*resultValue) | 通过指定资源名称,获取对应的单复数字符串。 |
79| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetIntPluralString](#oh_resourcemanager_getintpluralstring) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t num, char \*\*resultValue,...) | 通过指定资源ID,获取对应的单复数字符串。  |
80| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetDoublePluralString](#oh_resourcemanager_getdoublepluralstring) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, double num, char \*\*resultValue,...) | 通过指定资源ID,获取对应的单复数字符串。  |
81| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetIntPluralStringByName](#oh_resourcemanager_getintpluralstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t num, char \*\*resultValue,...) | 通过指定资源名称,获取对应的单复数字符串。  |
82| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetDoublePluralStringByName](#oh_resourcemanager_getdoublepluralstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, double num, char \*\*resultValue,...) | 通过指定资源名称,获取对应的单复数字符串。  |
83| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetColor](#oh_resourcemanager_getcolor) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t \*resultValue) | 通过指定资源ID,获取对应的颜色值。 |
84| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetColorByName](#oh_resourcemanager_getcolorbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t \*resultValue) | 通过指定资源ID,获取对应的颜色值。 |
85| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetInt](#oh_resourcemanager_getint) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, int \*resultValue) | 通过指定资源ID,获取对应的int值。 |
86| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetIntByName](#oh_resourcemanager_getintbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, int \*resultValue) | 通过指定资源名称,获取对应的int值。 |
87| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetFloat](#oh_resourcemanager_getfloat) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, float \*resultValue) | 通过指定资源ID,获取对应的float值。 |
88| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetFloatByName](#oh_resourcemanager_getfloatbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, float \*resultValue) | 通过指定资源名称,获取对应的float值。 |
89| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetBool](#oh_resourcemanager_getbool) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, bool \*resultValue) | 通过指定资源ID,获取对应的bool值。 |
90| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetBoolByName](#oh_resourcemanager_getboolbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, bool \*resultValue) | 通过指定资源名称,获取对应的bool值。 |
91| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_AddResource](#oh_resourcemanager_addresource) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*path) | 在应用程序运行时添加overlay资源。 |
92| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_RemoveResource](#oh_resourcemanager_removeresource) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*path) | 在应用程序运行时删除overlay资源。 |
93
94
95## 类型定义说明
96
97
98### ResourceManager_ColorMode
99
100```
101typedef enum ResourceManager_ColorModeResourceManager_ColorMode
102```
103
104**描述**
105
106颜色模式的枚举。
107
108**起始版本:** 12
109
110
111### ResourceManager_Configuration
112
113```
114typedef struct ResourceManager_ConfigurationResourceManager_Configuration
115```
116
117**描述**
118
119设备状态的枚举。
120
121**起始版本:** 12
122
123
124### ResourceManager_DeviceType
125
126```
127typedef enum ResourceManager_DeviceTypeResourceManager_DeviceType
128```
129
130**描述**
131
132设备类型的枚举。
133
134**起始版本:** 12
135
136
137### ResourceManager_Direction
138
139```
140typedef enum ResourceManager_DirectionResourceManager_Direction
141```
142
143**描述**
144
145屏幕方向的枚举。
146
147**起始版本:** 12
148
149
150## 枚举类型说明
151
152
153### ResourceManager_ColorMode
154
155```
156enum ResourceManager_ColorMode
157```
158
159**描述**
160
161颜色模式的枚举。
162
163**起始版本:** 12
164
165| 枚举值 | 描述 |
166| -------- | -------- |
167| DARK | 表示深色模式。 |
168| LIGHT | 表示浅色模式。 |
169
170
171### ResourceManager_DeviceType
172
173```
174enum ResourceManager_DeviceType
175```
176
177**描述**
178
179设备类型的枚举。
180
181**起始版本:** 12
182
183| 枚举值 | 描述 |
184| -------- | -------- |
185| DEVICE_TYPE_PHONE | 手机。 |
186| DEVICE_TYPE_TABLET | 平板。 |
187| DEVICE_TYPE_CAR | 汽车。 |
188| DEVICE_TYPE_PC | 电脑。 |
189| DEVICE_TYPE_TV | 电视。 |
190| DEVICE_TYPE_WEARABLE | 穿戴。 |
191| DEVICE_TYPE_2IN1 | 2in1设备。 |
192
193
194### ResourceManager_Direction
195
196```
197enum ResourceManager_Direction
198```
199
200**描述**
201
202屏幕方向的枚举。
203
204**起始版本:** 12
205
206| 枚举值 | 描述 |
207| -------- | -------- |
208| DIRECTION_VERTICAL | 表示垂直方向。 |
209| DIRECTION_HORIZONTAL | 表示水平方向。 |
210
211
212### ResourceManager_ErrorCode
213
214```
215enum ResourceManager_ErrorCode
216```
217
218**描述**
219
220资源管理错误码。
221
222**起始版本:** 12
223
224| 枚举值 | 描述 |
225| -------- | -------- |
226| SUCCESS | 成功。 |
227| ERROR_CODE_INVALID_INPUT_PARAMETER | 输入参数无效。 |
228| ERROR_CODE_RES_ID_NOT_FOUND | 无效的资源ID。 |
229| ERROR_CODE_RES_NOT_FOUND_BY_ID | 无效的资源名称。 |
230| ERROR_CODE_RES_NAME_NOT_FOUND | 没有根据资源ID找到匹配的资源。 |
231| ERROR_CODE_RES_NOT_FOUND_BY_NAME | 没有根据资源名称找到匹配的资源。 |
232| ERROR_CODE_RES_PATH_INVALID | 无效的相对路径。 |
233| ERROR_CODE_RES_REF_TOO_MUCH | 资源被循环引用。 |
234| ERROR_CODE_RES_ID_FORMAT_ERROR | 无法格式化基于资源ID获得的资源。 |
235| ERROR_CODE_RES_NAME_FORMAT_ERROR | 无法格式化基于资源名称获得的资源。 |
236| ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED | 访问系统资源失败。 |
237| ERROR_CODE_OVERLAY_RES_PATH_INVALID | 无效的overlay路径。 |
238| ERROR_CODE_OUT_OF_MEMORY | 内存溢出。 |
239
240
241### ScreenDensity
242
243```
244enum ScreenDensity
245```
246
247**描述**
248
249屏幕密度类型的枚举。
250
251**起始版本:** 12
252
253| 枚举值 | 描述 |
254| -------- | -------- |
255| SCREEN_SDPI | 表示小屏幕密度。 |
256| SCREEN_MDPI | 表示中屏幕密度。 |
257| SCREEN_LDPI | 表示大屏幕密度。 |
258| SCREEN_XLDPI | 表示特大屏幕密度。 |
259| SCREEN_XXLDPI | 表示超大屏幕密度。 |
260| SCREEN_XXXLDPI | 表示超特大屏幕密度。 |
261
262
263## 函数说明
264
265
266### OH_ResourceManager_AddResource()
267
268```
269ResourceManager_ErrorCode OH_ResourceManager_AddResource (const NativeResourceManager * mgr, const char * path )
270```
271
272**描述**
273
274在应用程序运行时添加overlay资源。
275
276**起始版本:** 12
277
278**参数:**
279
280| 名称 | 描述 |
281| -------- | -------- |
282| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
283| path | 资源路径。 |
284
285**返回:**
286
287SUCCESS 0 - 成功。
288
289ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
290
291ERROR_CODE_OVERLAY_RES_PATH_INVALID 9001010 - 无效的资源路径。
292
293
294### OH_ResourceManager_GetBool()
295
296```
297ResourceManager_ErrorCode OH_ResourceManager_GetBool (const NativeResourceManager * mgr, uint32_t resId, bool * resultValue )
298```
299
300**描述**
301
302通过指定资源ID,获取对应的bool值。
303
304**起始版本:** 12
305
306**参数:**
307
308| 名称 | 描述 |
309| -------- | -------- |
310| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
311| resId | 资源ID。 |
312| resultValue | 写入resultValue的结果。 |
313
314**返回:**
315
316SUCCESS 0 - 成功。
317
318ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
319
320ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
321
322ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
323
324ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
325
326
327### OH_ResourceManager_GetBoolByName()
328
329```
330ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName (const NativeResourceManager * mgr, const char * resName, bool * resultValue )
331```
332
333**描述**
334
335通过指定资源名称,获取对应的bool值。
336
337**起始版本:** 12
338
339**参数:**
340
341| 名称 | 描述 |
342| -------- | -------- |
343| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
344| resName | 资源名称。 |
345| resultValue | 写入resultValue的结果。 |
346
347**返回:**
348
349SUCCESS 0 - 成功。
350
351ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
352
353ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
354
355ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
356
357ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
358
359
360### OH_ResourceManager_GetColor()
361
362```
363ResourceManager_ErrorCode OH_ResourceManager_GetColor (const NativeResourceManager * mgr, uint32_t resId, uint32_t * resultValue )
364```
365
366**描述**
367
368通过指定资源ID,获取对应的颜色值。
369
370**起始版本:** 12
371
372**参数:**
373
374| 名称 | 描述 |
375| -------- | -------- |
376| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
377| resId | 资源ID。 |
378| resultValue | 写入resultValue的结果。 |
379
380**返回:**
381
382SUCCESS 0 - 成功。
383
384ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
385
386ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
387
388ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
389
390ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
391
392
393### OH_ResourceManager_GetColorByName()
394
395```
396ResourceManager_ErrorCode OH_ResourceManager_GetColorByName (const NativeResourceManager * mgr, const char * resName, uint32_t * resultValue )
397```
398
399**描述**
400
401通过指定资源ID,获取对应的颜色值。
402
403**起始版本:** 12
404
405**参数:**
406
407| 名称 | 描述 |
408| -------- | -------- |
409| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
410| resName | 资源名称。 |
411| resultValue | 写入resultValue的结果。 |
412
413**返回:**
414
415SUCCESS 0 - 成功。
416
417ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
418
419ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
420
421ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
422
423ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
424
425
426### OH_ResourceManager_GetConfiguration()
427
428```
429ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration (const NativeResourceManager * mgr, ResourceManager_Configuration * configuration )
430```
431
432**描述**
433
434获取设备配置。
435
436使用此接口后,需要调用OH_ResourceManager_ReleaseConfiguration()方法来释放内存。 如果使用malloc创建ResourceManager_Configuration对象,还需要调用free()方法来释放它。
437
438**起始版本:** 12
439
440**参数:**
441
442| 名称 | 描述 |
443| -------- | -------- |
444| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
445| configuration | 写入configuration的结果。 |
446
447**返回:**
448
449SUCCESS 0 - 成功。
450
451ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
452
453ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED 9001009 - 无法访问系统资源。
454
455ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
456
457
458### OH_ResourceManager_GetDoublePluralString()
459
460```
461ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralString (const NativeResourceManager * mgr, uint32_t resId, double num, char ** resultValue,  ... )
462```
463
464**描述**
465
466通过指定资源ID,获取对应的单复数字符串。
467
468使用此接口后,需要调用free()方法来释放字符串的内存。
469
470**起始版本:** 18
471
472**参数:**
473
474| 名称 | 描述 |
475| -------- | -------- |
476| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。  |
477| resId | 资源ID。  |
478| num | 数量值(浮点数)。根据当前语言的复数规则获取该数量值对应的字符串数字。  |
479| resultValue | 写入resultValue的结果。  |
480| ... | 格式化字符串资源参数,可变参数,支持const char\*、int、float类型。  |
481
482**返回:**
483
484SUCCESS 0 - 成功。
485
486ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
487
488ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
489
490ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
491
492ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
493
494ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
495
496
497### OH_ResourceManager_GetDoublePluralStringByName()
498
499```
500ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralStringByName (const NativeResourceManager * mgr, const char * resName, double num, char ** resultValue,  ... )
501```
502**描述**
503
504通过指定资源名称,获取对应的单复数字符串。
505
506使用此接口后,需要调用free()方法来释放字符串的内存。
507
508**起始版本:** 18
509
510**参数:**
511
512| 名称 | 描述 |
513| -------- | -------- |
514| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。  |
515| resName | 资源名称。  |
516| num | 数量值(浮点数)。根据当前语言的复数规则获取该数量值对应的字符串数字。  |
517| resultValue | 写入resultValue的结果。  |
518| ... | 格式化字符串资源参数,可变参数,支持const char\*、int、float类型。  |
519
520**返回:**
521
522SUCCESS 0 - 成功。
523
524ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
525
526ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
527
528ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
529
530ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
531
532ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
533
534
535### OH_ResourceManager_GetDrawableDescriptor()
536
537```
538ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor (const NativeResourceManager * mgr, uint32_t resId, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density = 0, uint32_t type = 0 )
539```
540
541**描述**
542
543通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。
544
545**起始版本:** 12
546
547**参数:**
548
549| 名称 | 描述 |
550| -------- | -------- |
551| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
552| resId | 资源ID。 |
553| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),默认值为0,表示使用当前系统dpi的密度。 |
554| type | 可选参数,表示图标类型,0表示自身图标,1表示主题图标。 |
555| drawableDescriptor | 写入drawableDescriptor的结果。 |
556
557**返回:**
558
559SUCCESS 0 - 成功。
560
561ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
562
563ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
564
565ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
566
567
568### OH_ResourceManager_GetDrawableDescriptorByName()
569
570```
571ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName (const NativeResourceManager * mgr, const char * resName, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density = 0, uint32_t type = 0 )
572```
573
574**描述**
575
576通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。
577
578**起始版本:** 12
579
580**参数:**
581
582| 名称 | 描述 |
583| -------- | -------- |
584| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
585| resName | 资源名称。 |
586| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),默认值为0,表示使用当前系统dpi的密度。 |
587| type | 可选参数,表示图标类型,0表示自身图标,1表示主题图标,2表示动态图标。 |
588| drawableDescriptor | 写入drawableDescriptor的结果。 |
589
590**返回:**
591
592SUCCESS 0 - 成功。
593
594ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
595
596ERROR_CODE_RES_NAME_NOT_FOUND 9001003 - 无效的资源名称。
597
598ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004 - 没有根据资源名称找到匹配的资源。
599
600
601### OH_ResourceManager_GetDrawableDescriptorData()
602
603```
604ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorData (const NativeResourceManager * mgr, uint32_t resId, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density, uint32_t type )
605```
606
607**描述**
608
609通过指定资源Id,获取屏幕密度对应的图标资源的DrawableDescriptor。
610
611**起始版本:** 12
612
613**参数:**
614
615| 名称 | 描述 |
616| -------- | -------- |
617| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
618| resId | 资源ID。 |
619| drawableDescriptor | 写入drawableDescriptor的结果。 |
620| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 |
621| type | 可选参数,表示图标类型,0表示自身图标,1表示主题图标。如果该属性不是必需的,请将该参数设为0。 |
622
623**返回:**
624
625SUCCESS 0 - 成功。
626
627ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
628
629ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
630
631ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
632
633
634### OH_ResourceManager_GetDrawableDescriptorDataByName()
635
636```
637ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorDataByName (const NativeResourceManager * mgr, const char * resName, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density, uint32_t type )
638```
639
640**描述**
641
642通过指定资源名称,获取屏幕密度对应的图标资源的DrawableDescriptor。
643
644**起始版本:** 12
645
646**参数:**
647
648| 名称 | 描述 |
649| -------- | -------- |
650| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
651| resName | 资源名称。 |
652| drawableDescriptor | 写入drawableDescriptor的结果。 |
653| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 |
654| type | 可选参数,表示图标类型,0表示自身图标,1表示主题图标。如果该属性不是必需的,请将该参数设为0。 |
655
656**返回:**
657
658SUCCESS 0 - 成功。
659
660ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
661
662ERROR_CODE_RES_NAME_NOT_FOUND 9001003 - 无效的资源名称。
663
664ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004 - 没有根据资源名称找到匹配的资源。
665
666
667### OH_ResourceManager_GetFloat()
668
669```
670ResourceManager_ErrorCode OH_ResourceManager_GetFloat (const NativeResourceManager * mgr, uint32_t resId, float * resultValue )
671```
672
673**描述**
674
675通过指定资源ID,获取对应的float值。
676
677**起始版本:** 12
678
679**参数:**
680
681| 名称 | 描述 |
682| -------- | -------- |
683| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
684| resId | 资源ID。 |
685| resultValue | 写入resultValue的结果。 |
686
687**返回:**
688
689SUCCESS 0 - 成功。
690
691ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
692
693ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
694
695ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
696
697ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
698
699
700### OH_ResourceManager_GetFloatByName()
701
702```
703ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName (const NativeResourceManager * mgr, const char * resName, float * resultValue )
704```
705
706**描述**
707
708通过指定资源名称,获取对应的float值。
709
710**起始版本:** 12
711
712**参数:**
713
714| 名称 | 描述 |
715| -------- | -------- |
716| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
717| resName | 资源名称。 |
718| resultValue | 写入resultValue的结果。 |
719
720**返回:**
721
722SUCCESS 0 - 成功。
723
724ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
725
726ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
727
728ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
729
730ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
731
732
733### OH_ResourceManager_GetInt()
734
735```
736ResourceManager_ErrorCode OH_ResourceManager_GetInt (const NativeResourceManager * mgr, uint32_t resId, int * resultValue )
737```
738
739**描述**
740
741通过指定资源ID,获取对应的int值。
742
743**起始版本:** 12
744
745**参数:**
746
747| 名称 | 描述 |
748| -------- | -------- |
749| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
750| resId | 资源ID。 |
751| resultValue | 写入resultValue的结果。 |
752
753**返回:**
754
755SUCCESS 0 - 成功。
756
757ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
758
759ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
760
761ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
762
763ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
764
765
766### OH_ResourceManager_GetIntByName()
767
768```
769ResourceManager_ErrorCode OH_ResourceManager_GetIntByName (const NativeResourceManager * mgr, const char * resName, int * resultValue )
770```
771
772**描述**
773
774通过指定资源名称,获取对应的int值。
775
776**起始版本:** 12
777
778**参数:**
779
780| 名称 | 描述 |
781| -------- | -------- |
782| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
783| resName | 资源名称。 |
784| resultValue | 写入resultValue的结果。 |
785
786**返回:**
787
788SUCCESS 0 - 成功。
789
790ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
791
792ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
793
794ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
795
796ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
797
798
799### OH_ResourceManager_GetIntPluralString()
800
801```
802ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralString (const NativeResourceManager * mgr, uint32_t resId, uint32_t num, char ** resultValue,  ... )
803```
804
805**描述**
806
807通过指定资源ID,获取对应的单复数字符串。
808
809使用此接口后,需要调用free()方法来释放字符串的内存。
810
811**起始版本:** 18
812
813**参数:**
814
815| 名称 | 描述 |
816| -------- | -------- |
817| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。  |
818| resId | 资源ID。  |
819| num | 数量值(整数)。根据当前语言的复数规则获取该数量值对应的字符串数字。  |
820| resultValue | 写入resultValue的结果。  |
821| ... | 格式化字符串资源参数,可变参数,支持const char\*、int、float类型。  |
822
823**返回:**
824
825SUCCESS 0 - 成功。
826
827ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
828
829ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
830
831ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
832
833ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
834
835ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
836
837
838### OH_ResourceManager_GetIntPluralStringByName()
839
840```
841ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralStringByName (const NativeResourceManager * mgr, const char * resName, uint32_t num, char ** resultValue,  ... )
842```
843**描述**
844
845通过指定资源名称,获取对应的单复数字符串。
846
847使用此接口后,需要调用free()方法来释放字符串的内存。
848
849**起始版本:** 18
850
851**参数:**
852
853| 名称 | 描述 |
854| -------- | -------- |
855| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。  |
856| resName | 资源名称。  |
857| num | 数量值(整数)。根据当前语言的复数规则获取该数量值对应的字符串数字。  |
858| resultValue | 写入resultValue的结果。  |
859| ... | 格式化字符串资源参数,可变参数,支持const char\*、int、float类型。  |
860
861**返回:**
862
863SUCCESS 0 - 成功。
864
865ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
866
867ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
868
869ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
870
871ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
872
873ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
874
875
876### OH_ResourceManager_GetLocales()
877
878```
879ResourceManager_ErrorCode OH_ResourceManager_GetLocales (const NativeResourceManager * mgr, char *** resultValue, uint32_t * resultLen, bool includeSystem = false )
880```
881
882**描述**
883
884获取语言列表。
885
886使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()方法来释放localinfo的内存。
887
888**起始版本:** 12
889
890**参数:**
891
892| 名称 | 描述 |
893| -------- | -------- |
894| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
895| resultValue | 写入resultValue的结果。 |
896| resultLen | 写入resultLen的locales长度。 |
897| includeSystem | 是否包含系统资源,默认值为false,当只有系统资源查询locales列表时它不起作用。 |
898
899**返回:**
900
901SUCCESS 0 - 成功。
902
903ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
904
905ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
906
907
908### OH_ResourceManager_GetLocalesData()
909
910```
911ResourceManager_ErrorCode OH_ResourceManager_GetLocalesData (const NativeResourceManager * mgr, char *** resultValue, uint32_t * resultLen, bool includeSystem )
912```
913
914**描述**
915
916获取语言列表。
917
918使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()方法来释放localinfo的内存。
919
920**起始版本:** 12
921
922**参数:**
923
924| 名称 | 描述 |
925| -------- | -------- |
926| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
927| resultValue | 写入resultValue的结果。 |
928| resultLen | 写入resultLen的locales长度。 |
929| includeSystem | 是否包含系统资源,如果不需要此属性,请将此参数设置为 false。 |
930
931**返回:**
932
933SUCCESS 0 - 成功。
934
935ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
936
937ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
938
939
940### OH_ResourceManager_GetMedia()
941
942```
943ResourceManager_ErrorCode OH_ResourceManager_GetMedia (const NativeResourceManager * mgr, uint32_t resId, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
944```
945
946**描述**
947
948通过指定资源ID,获取屏幕密度对应的media资源的内容。
949
950**起始版本:** 12
951
952**参数:**
953
954| 名称 | 描述 |
955| -------- | -------- |
956| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
957| resId | 资源ID。 |
958| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),默认值为0,表示使用当前系统dpi的密度。 |
959| resultValue | 写入resultValue的结果。 |
960| resultLen | 写入resultLen的media长度。 |
961
962**返回:**
963
964SUCCESS 0 - 成功。
965
966ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
967
968ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
969
970ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
971
972ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
973
974
975### OH_ResourceManager_GetMediaBase64()
976
977```
978ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64 (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
979```
980
981**描述**
982
983通过指定资源ID,获取屏幕密度对应的media资源的Base64码。
984
985**起始版本:** 12
986
987**参数:**
988
989| 名称 | 描述 |
990| -------- | -------- |
991| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
992| resId | 资源ID。 |
993| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),默认值为0,表示使用当前系统dpi的密度。 |
994| resultValue | 写入resultValue的结果。 |
995| resultLen | 写入resultLen的media长度。 |
996
997**返回:**
998
999SUCCESS 0 - 成功。
1000
1001ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1002
1003ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
1004
1005ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
1006
1007ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1008
1009
1010### OH_ResourceManager_GetMediaBase64ByName()
1011
1012```
1013ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
1014```
1015
1016**描述**
1017
1018通过指定资源名称,获取屏幕密度对应的media资源的Base64码。
1019
1020**起始版本:** 12
1021
1022**参数:**
1023
1024| 名称 | 描述 |
1025| -------- | -------- |
1026| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1027| resName | 资源名称。 |
1028| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),默认值为0,表示使用当前系统dpi的密度。 |
1029| resultValue | 写入resultValue的结果。 |
1030| resultLen | 写入resultLen的media长度。 |
1031
1032**返回:**
1033
1034SUCCESS 0 - 成功。
1035
1036ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1037
1038ERROR_CODE_RES_NAME_NOT_FOUND 9001003 - 无效的资源名称。
1039
1040ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004 - 没有根据资源名称找到匹配的资源。
1041
1042ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1043
1044
1045### OH_ResourceManager_GetMediaBase64Data()
1046
1047```
1048ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64Data (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue, uint64_t * resultLen, uint32_t density )
1049```
1050
1051**描述**
1052
1053通过指定资源ID,获取屏幕密度对应的media资源的Base64码。
1054
1055**起始版本:** 12
1056
1057**参数:**
1058
1059| 名称 | 描述 |
1060| -------- | -------- |
1061| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1062| resId | 资源ID。 |
1063| resultValue | 写入resultValue的结果。 |
1064| resultLen | 写入resultLen的media长度。 |
1065| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 |
1066
1067**返回:**
1068
1069SUCCESS 0 - 成功。
1070
1071ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1072
1073ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
1074
1075ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
1076
1077ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1078
1079
1080### OH_ResourceManager_GetMediaBase64DataByName()
1081
1082```
1083ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64DataByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue, uint64_t * resultLen, uint32_t density )
1084```
1085
1086**描述**
1087
1088通过指定资源名称,获取屏幕密度对应的media资源的Base64码。
1089
1090**起始版本:** 12
1091
1092**参数:**
1093
1094| 名称 | 描述 |
1095| -------- | -------- |
1096| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1097| resName | 资源名称。 |
1098| resultValue | 写入resultValue的结果。 |
1099| resultLen | 写入resultLen的media长度。 |
1100| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 |
1101
1102**返回:**
1103
1104SUCCESS 0 - 成功。
1105
1106ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1107
1108ERROR_CODE_RES_NAME_NOT_FOUND 9001003 - 无效的资源名称。
1109
1110ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004 - 没有根据资源名称找到匹配的资源。
1111
1112ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1113
1114
1115### OH_ResourceManager_GetMediaByName()
1116
1117```
1118ResourceManager_ErrorCode OH_ResourceManager_GetMediaByName (const NativeResourceManager * mgr, const char * resName, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
1119```
1120
1121**描述**
1122
1123通过指定资源名称,获取屏幕密度对应的media资源的内容。
1124
1125**起始版本:** 12
1126
1127**参数:**
1128
1129| 名称 | 描述 |
1130| -------- | -------- |
1131| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1132| resName | 资源名称。 |
1133| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),默认值为0,表示使用当前系统dpi的密度。 |
1134| resultValue | 写入resultValue的结果。 |
1135| resultLen | 写入resultLen的media长度。 |
1136
1137**返回:**
1138
1139SUCCESS 0 - 成功。
1140
1141ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1142
1143ERROR_CODE_RES_NAME_NOT_FOUND 9001003 - 无效的资源名称。
1144
1145ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004 - 没有根据资源名称找到匹配的资源。
1146
1147ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1148
1149
1150### OH_ResourceManager_GetMediaData()
1151
1152```
1153ResourceManager_ErrorCode OH_ResourceManager_GetMediaData (const NativeResourceManager * mgr, uint32_t resId, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density )
1154```
1155
1156**描述**
1157
1158通过指定资源ID,获取屏幕密度对应的media资源的内容。
1159
1160**起始版本:** 12
1161
1162**参数:**
1163
1164| 名称 | 描述 |
1165| -------- | -------- |
1166| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1167| resId | 资源ID。 |
1168| resultValue | 写入resultValue的结果。 |
1169| resultLen | 写入resultLen的media长度。 |
1170| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 |
1171
1172**返回:**
1173
1174SUCCESS 0 - 成功。
1175
1176ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1177
1178ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
1179
1180ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
1181
1182ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1183
1184
1185### OH_ResourceManager_GetMediaDataByName()
1186
1187```
1188ResourceManager_ErrorCode OH_ResourceManager_GetMediaDataByName (const NativeResourceManager * mgr, const char * resName, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density )
1189```
1190
1191**描述**
1192
1193通过指定资源名称,获取屏幕密度对应的media资源的内容。
1194
1195**起始版本:** 12
1196
1197**参数:**
1198
1199| 名称 | 描述 |
1200| -------- | -------- |
1201| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1202| resName | 资源名称。 |
1203| resultValue | 写入resultValue的结果。 |
1204| resultLen | 写入resultLen的media长度。 |
1205| density | 可选参数,取值范围参考[ScreenDensity](#screendensity),值为0表示使用当前系统dpi的密度。如果不需要此属性,请将此参数设置为0。 |
1206
1207**返回:**
1208
1209SUCCESS 0 - 成功。
1210
1211ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1212
1213ERROR_CODE_RES_NAME_NOT_FOUND 9001003 - 无效的资源名称。
1214
1215ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004 - 没有根据资源名称找到匹配的资源。
1216
1217ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1218
1219
1220### OH_ResourceManager_GetPluralString()
1221
1222```
1223ResourceManager_ErrorCode OH_ResourceManager_GetPluralString (const NativeResourceManager * mgr, uint32_t resId, uint32_t num, char ** resultValue )
1224```
1225
1226**描述**
1227
1228通过指定资源ID,获取对应的单复数字符串。
1229
1230使用此接口后,需要调用free()方法来释放字符串的内存。
1231
1232**起始版本:** 12
1233
1234**废弃版本:** 18
1235
1236**替代接口:**[OH_ResourceManager_GetIntPluralString](#oh_resourcemanager_getintpluralstring)
1237
1238**参数:**
1239
1240| 名称 | 描述 |
1241| -------- | -------- |
1242| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。  |
1243| resId | 资源ID。  |
1244| num | 数量值。  |
1245| resultValue | 写入resultValue的结果。  |
1246
1247**返回:**
1248
1249SUCCESS 0 - 成功。
1250
1251ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1252
1253ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
1254
1255ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
1256
1257ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1258
1259ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1260
1261
1262### OH_ResourceManager_GetPluralStringByName()
1263
1264```
1265ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName (const NativeResourceManager * mgr, const char * resName, uint32_t num, char ** resultValue )
1266```
1267**描述**
1268
1269通过指定资源名称,获取对应的单复数字符串。
1270
1271使用此接口后,需要调用free()方法来释放字符串的内存。
1272
1273**起始版本:** 12
1274
1275**废弃版本:** 18
1276
1277**替代接口:**[OH_ResourceManager_GetIntPluralStringByName](#oh_resourcemanager_getintpluralstringbyname)
1278
1279**参数:**
1280
1281| 名称 | 描述 |
1282| -------- | -------- |
1283| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。  |
1284| resName | 资源名称。  |
1285| num | 数量值。  |
1286| resultValue | 写入resultValue的结果。  |
1287
1288**返回:**
1289
1290SUCCESS 0 - 成功。
1291
1292ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1293
1294ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
1295
1296ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
1297
1298ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1299
1300ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1301
1302
1303### OH_ResourceManager_GetString()
1304
1305```
1306ResourceManager_ErrorCode OH_ResourceManager_GetString (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue,  ... )
1307```
1308
1309**描述**
1310
1311通过指定资源ID,获取对应的string资源。
1312
1313获取普通string资源使用OH_ResourceManager_GetString(mgr, resId, resultValue)接口。 获取带有d、s、f占位符的格式化资源使用OH_ResourceManager_GetString(mgr, resId, resultValue, 10, "format", 10.10)接口。 使用此接口后,需要调用free()方法来释放字符串的内存。
1314
1315**起始版本:** 12
1316
1317**参数:**
1318
1319| 名称 | 描述 |
1320| -------- | -------- |
1321| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1322| resId | 资源ID。 |
1323| resultValue | 写入resultValue的结果。 |
1324| ... | 格式化字符串资源参数,可变参数,支持const char\*、int、float类型。 |
1325
1326**返回:**
1327
1328SUCCESS 0 - 成功。
1329
1330ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1331
1332ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
1333
1334ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
1335
1336ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1337
1338ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1339
1340
1341### OH_ResourceManager_GetStringArray()
1342
1343```
1344ResourceManager_ErrorCode OH_ResourceManager_GetStringArray (const NativeResourceManager * mgr, uint32_t resId, char *** resultValue, uint32_t * resultLen )
1345```
1346
1347**描述**
1348
1349通过指定资源ID,获取字符串数组。
1350
1351使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()接口来释放字符串数组内存。
1352
1353**起始版本:** 12
1354
1355**参数:**
1356
1357| 名称 | 描述 |
1358| -------- | -------- |
1359| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1360| resId | 资源ID。 |
1361| resultValue | 写入resultValue的结果。 |
1362| resultLen | 写入resultLen的StringArray长度。 |
1363
1364**返回:**
1365
1366SUCCESS 0 - 成功。
1367
1368ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1369
1370ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
1371
1372ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
1373
1374ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1375
1376ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1377
1378
1379### OH_ResourceManager_GetStringArrayByName()
1380
1381```
1382ResourceManager_ErrorCode OH_ResourceManager_GetStringArrayByName (const NativeResourceManager * mgr, const char * resName, char *** resultValue, uint32_t * resultLen )
1383```
1384
1385**描述**
1386
1387通过指定资源名称,获取字符串数组。
1388
1389使用此接口后,需要调用OH_ResourceManager_ReleaseStringArray()接口来释放字符串数组内存。
1390
1391**起始版本:** 12
1392
1393**参数:**
1394
1395| 名称 | 描述 |
1396| -------- | -------- |
1397| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1398| resName | 资源名称。 |
1399| resultValue | 写入resultValue的结果。 |
1400| resultLen | 写入resultLen的StringArray长度。 |
1401
1402**返回:**
1403
1404SUCCESS 0 - 成功。
1405
1406ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1407
1408ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
1409
1410ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
1411
1412ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1413
1414ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1415
1416
1417### OH_ResourceManager_GetStringByName()
1418
1419```
1420ResourceManager_ErrorCode OH_ResourceManager_GetStringByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue,  ... )
1421```
1422
1423**描述**
1424
1425通过指定资源名称,获取对应的string资源。
1426
1427获取普通string资源使用OH_ResourceManager_GetString(mgr, resName, resultValue)接口。 获取带有%d、%s、%f占位符的格式化资源使用OH_ResourceManager_GetString(mgr, resName, resultValue, 10, "format", 10.10)接口。 使用此接口后,需要调用free()方法来释放字符串的内存。
1428
1429**起始版本:** 12
1430
1431**参数:**
1432
1433| 名称 | 描述 |
1434| -------- | -------- |
1435| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1436| resName | 资源名称。 |
1437| resultValue | 写入resultValue的结果。 |
1438| ... | 格式化字符串资源参数,可变参数,支持const char\*、int、float类型。 |
1439
1440**返回:**
1441
1442SUCCESS 0 - 成功。
1443
1444ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1445
1446ERROR_CODE_RES_ID_NOT_FOUND 9001003 - 无效的资源名称。
1447
1448ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - 没有根据资源名称找到匹配的资源。
1449
1450ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1451
1452ERROR_CODE_OUT_OF_MEMORY 9001100 - 内存溢出。
1453
1454
1455### OH_ResourceManager_GetSymbol()
1456
1457```
1458ResourceManager_ErrorCode OH_ResourceManager_GetSymbol (const NativeResourceManager * mgr, uint32_t resId, uint32_t * resultValue )
1459```
1460
1461**描述**
1462
1463通过指定资源ID,获取对应的symbol资源。
1464
1465**起始版本:** 12
1466
1467**参数:**
1468
1469| 名称 | 描述 |
1470| -------- | -------- |
1471| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1472| resId | 资源ID。 |
1473| resultValue | 写入resultValue的结果。 |
1474
1475**返回:**
1476
1477SUCCESS 0 - 成功。
1478
1479ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1480
1481ERROR_CODE_RES_ID_NOT_FOUND 9001001 - 无效的资源ID。
1482
1483ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - 没有根据资源ID找到匹配的资源。
1484
1485ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1486
1487
1488### OH_ResourceManager_GetSymbolByName()
1489
1490```
1491ResourceManager_ErrorCode OH_ResourceManager_GetSymbolByName (const NativeResourceManager * mgr, const char * resName, uint32_t * resultValue )
1492```
1493
1494**描述**
1495
1496通过指定资源名称,获取对应的symbol资源。
1497
1498**起始版本:** 12
1499
1500**参数:**
1501
1502| 名称 | 描述 |
1503| -------- | -------- |
1504| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1505| resName | 资源名称。 |
1506| resultValue | 写入resultValue的结果。 |
1507
1508**返回:**
1509
1510SUCCESS 0 - 成功。
1511
1512ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1513
1514ERROR_CODE_RES_NAME_NOT_FOUND 9001003 - 无效的资源名称。
1515
1516ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004 - 没有根据资源名称找到匹配的资源。
1517
1518ERROR_CODE_RES_REF_TOO_MUCH 9001006 - 资源被循环引用。
1519
1520
1521### OH_ResourceManager_ReleaseConfiguration()
1522
1523```
1524ResourceManager_ErrorCode OH_ResourceManager_ReleaseConfiguration (ResourceManager_Configuration * configuration)
1525```
1526
1527**描述**
1528
1529释放OH_ResourceManager_GetConfiguration()方法申请的内存。
1530
1531**起始版本:** 12
1532
1533**参数:**
1534
1535| 名称 | 描述 |
1536| -------- | -------- |
1537| configuration | 需要释放内存的configuration对象。 |
1538
1539**返回:**
1540
1541SUCCESS 0 - 成功。
1542
1543ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1544
1545
1546### OH_ResourceManager_ReleaseStringArray()
1547
1548```
1549ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray (char *** resValue, uint32_t len )
1550```
1551
1552**描述**
1553
1554释放字符串数组内存。
1555
1556**起始版本:** 12
1557
1558**参数:**
1559
1560| 名称 | 描述 |
1561| -------- | -------- |
1562| resValue | 需要释放的字符串数组。 |
1563| len | 字符串数组长度。 |
1564
1565**返回:**
1566
1567SUCCESS 0 - 成功。
1568
1569ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1570
1571
1572### OH_ResourceManager_RemoveResource()
1573
1574```
1575ResourceManager_ErrorCode OH_ResourceManager_RemoveResource (const NativeResourceManager * mgr, const char * path )
1576```
1577
1578**描述**
1579
1580在应用程序运行时删除overlay资源。
1581
1582**起始版本:** 12
1583
1584**参数:**
1585
1586| 名称 | 描述 |
1587| -------- | -------- |
1588| mgr | 指向[NativeResourceManager](rawfile.md#nativeresourcemanager)的指针,此指针通过[OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager)方法获取。 |
1589| path | 资源路径。 |
1590
1591**返回:**
1592
1593SUCCESS 0 - 成功。
1594
1595ERROR_CODE_INVALID_INPUT_PARAMETER 401 - 输入参数无效。可能的原因:1.参数类型不正确;2.参数验证失败。
1596
1597ERROR_CODE_OVERLAY_RES_PATH_INVALID 9001010 - 无效的资源路径。