• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Resourcemanager
2
3
4## Overview
5
6Provides C APIs for obtaining resources.
7
8**Since**: 12
9
10
11## Summary
12
13
14### File
15
16| Name| Description|
17| -------- | -------- |
18| [ohresmgr.h](ohresmgr_8h.md) | Provides native APIs for obtaining resources.|
19| [resmgr_common.h](resmgr__common_8h.md) | Provides the enum types and structures for resource manager APIs.|
20
21
22### Structs
23
24| Name| Description|
25| -------- | -------- |
26| struct  [ResourceManager_Configuration](_resource_manager___configuration.md) | Enumerates device states.|
27
28
29### Types
30
31| Name| Description|
32| -------- | -------- |
33| typedef enum [ResourceManager_Direction](#resourcemanager_direction) [ResourceManager_Direction](#resourcemanager_direction) | Enumerates screen orientations.|
34| typedef enum [ResourceManager_ColorMode](#resourcemanager_colormode) [ResourceManager_ColorMode](#resourcemanager_colormode) | Enumerates color modes.|
35| typedef enum [ResourceManager_DeviceType](#resourcemanager_devicetype) [ResourceManager_DeviceType](#resourcemanager_devicetype) | Enumerates device types.|
36| typedef struct [ResourceManager_Configuration](_resource_manager___configuration.md) [ResourceManager_Configuration](#resourcemanager_configuration) | Enumerates device states.|
37
38
39### Enum
40
41| Name| Description|
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>} | Enumerates resource manager error codes.|
44| [ScreenDensity](#screendensity) {<br>SCREEN_SDPI = 120, SCREEN_MDPI = 160, SCREEN_LDPI = 240, SCREEN_XLDPI = 320,<br>SCREEN_XXLDPI = 480, SCREEN_XXXLDPI = 640<br>} | Enumerates screen density types.|
45| [ResourceManager_Direction](#resourcemanager_direction) { DIRECTION_VERTICAL = 0, DIRECTION_HORIZONTAL = 1 } | Enumerates screen orientations.|
46| [ResourceManager_ColorMode](#resourcemanager_colormode) { DARK = 0, LIGHT = 1 } | Enumerates color modes.|
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>} | Enumerates device types.|
48
49
50### Callback
51
52| Name| Description|
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) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.|
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) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.|
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) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.|
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) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.|
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) | Obtains the content of the media resource with the specified screen density based on the specified resource ID.|
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) | Obtains the content of the media resource with the specified screen density based on the specified resource ID.|
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) | Obtains the content of the media resource with the specified screen density based on the specified resource name.|
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) | Obtains the content of the media resource with the specified screen density based on the specified resource name.|
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) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.|
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) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.|
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) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.|
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) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.|
66| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetSymbol](#oh_resourcemanager_getsymbol) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t \*resultValue) | Obtains a **symbol** resource based on the specified resource ID.|
67| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetSymbolByName](#oh_resourcemanager_getsymbolbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t \*resultValue) | Obtains a **symbol** resource based on the specified resource name.|
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) | Obtains the language list.|
69| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetLocalesData](#oh_resourcemanager_getlocalesdata) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, char \*\*\*resultValue, uint32_t \*resultLen, bool includeSystem) | Obtains the language list.|
70| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetConfiguration](#oh_resourcemanager_getconfiguration) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, [ResourceManager_Configuration](_resource_manager___configuration.md) \*configuration) | Obtains the device configuration.|
71| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_ReleaseConfiguration](#oh_resourcemanager_releaseconfiguration) ([ResourceManager_Configuration](_resource_manager___configuration.md) \*configuration) | Releases the memory requested by using **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,...) | Obtains a **string** resource based on the specified resource ID.|
73| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetStringByName](#oh_resourcemanager_getstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*resultValue,...) | Obtains a **string** resource based on the specified resource name.|
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) | Obtains a string array based on the specified resource 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) | Obtains a string array based on the specified resource name.|
76| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_ReleaseStringArray](#oh_resourcemanager_releasestringarray) (char \*\*\*resValue, uint32_t len) | Releases the memory of the string array.|
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) | Obtains singular and plural strings based on the specified resource 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) | Obtains singular and plural strings based on the specified resource name.|
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,...) | Obtains singular and plural strings based on the specified resource 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,...) | Obtains singular and plural strings based on the specified resource 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,...) | Obtains singular and plural strings based on the specified resource name. |
82| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetDoublePluralStringByName](#oh_resourcemanager_getdoublepluralstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, double num, char \*\*resultValue,...) | Obtains singular and plural strings based on the specified resource name. |
83| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetColor](#oh_resourcemanager_getcolor) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t \*resultValue) | Obtains a color value based on the specified resource ID.|
84| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetColorByName](#oh_resourcemanager_getcolorbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t \*resultValue) | Obtains a color value based on the specified resource ID.|
85| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetInt](#oh_resourcemanager_getint) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, int \*resultValue) | Obtains an int value based on the specified resource ID.|
86| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetIntByName](#oh_resourcemanager_getintbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, int \*resultValue) | Obtains an int value based on the specified resource name.|
87| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetFloat](#oh_resourcemanager_getfloat) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, float \*resultValue) | Obtains a float value based on the specified resource ID.|
88| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetFloatByName](#oh_resourcemanager_getfloatbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, float \*resultValue) | Obtains a float value based on the specified resource name.|
89| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetBool](#oh_resourcemanager_getbool) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, bool \*resultValue) | Obtains a bool value based on the specified resource ID.|
90| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetBoolByName](#oh_resourcemanager_getboolbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, bool \*resultValue) | Obtains a bool value based on the specified resource name.|
91| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_AddResource](#oh_resourcemanager_addresource) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*path) | Adds overlay resources when an application is running.|
92| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_RemoveResource](#oh_resourcemanager_removeresource) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*path) | Removes overlay resources when an application is running.|
93
94
95## Type Description
96
97
98### ResourceManager_ColorMode
99
100```
101typedef enum ResourceManager_ColorModeResourceManager_ColorMode
102```
103
104**Description**
105
106Enumerates color modes.
107
108**Since**: 12
109
110
111### ResourceManager_Configuration
112
113```
114typedef struct ResourceManager_ConfigurationResourceManager_Configuration
115```
116
117**Description**
118
119Enumerates device states.
120
121**Since**: 12
122
123
124### ResourceManager_DeviceType
125
126```
127typedef enum ResourceManager_DeviceTypeResourceManager_DeviceType
128```
129
130**Description**
131
132Enumerates device types.
133
134**Since**: 12
135
136
137### ResourceManager_Direction
138
139```
140typedef enum ResourceManager_DirectionResourceManager_Direction
141```
142
143**Description**
144
145Enumerates screen orientations.
146
147**Since**: 12
148
149
150## Enum Description
151
152
153### ResourceManager_ColorMode
154
155```
156enum ResourceManager_ColorMode
157```
158
159**Description**
160
161Enumerates color modes.
162
163**Since**: 12
164
165| Value| Description|
166| -------- | -------- |
167| DARK | Dark mode.|
168| LIGHT | Light mode.|
169
170
171### ResourceManager_DeviceType
172
173```
174enum ResourceManager_DeviceType
175```
176
177**Description**
178
179Enumerates device types.
180
181**Since**: 12
182
183| Value| Description|
184| -------- | -------- |
185| DEVICE_TYPE_PHONE | Phone|
186| DEVICE_TYPE_TABLET | Tablet|
187| DEVICE_TYPE_CAR | Automobile|
188| DEVICE_TYPE_PC | Computer|
189| DEVICE_TYPE_TV | TV|
190| DEVICE_TYPE_WEARABLE | Wearable|
191| DEVICE_TYPE_2IN1 | 2-in-1 device|
192
193
194### ResourceManager_Direction
195
196```
197enum ResourceManager_Direction
198```
199
200**Description**
201
202Enumerates screen orientations.
203
204**Since**: 12
205
206| Value| Description|
207| -------- | -------- |
208| DIRECTION_VERTICAL | Vertical direction.|
209| DIRECTION_HORIZONTAL | Horizontal direction.|
210
211
212### ResourceManager_ErrorCode
213
214```
215enum ResourceManager_ErrorCode
216```
217
218**Description**
219
220Enumerates resource manager error codes.
221
222**Since**: 12
223
224| Value| Description|
225| -------- | -------- |
226| SUCCESS | Success.|
227| ERROR_CODE_INVALID_INPUT_PARAMETER | Invalid input parameter.|
228| ERROR_CODE_RES_ID_NOT_FOUND | Invalid resource ID.|
229| ERROR_CODE_RES_NOT_FOUND_BY_ID | Invalid resource name.|
230| ERROR_CODE_RES_NAME_NOT_FOUND | No matching resource found based on the resource ID.|
231| ERROR_CODE_RES_NOT_FOUND_BY_NAME | No matching resource found based on the resource name.|
232| ERROR_CODE_RES_PATH_INVALID | Invalid relative path.|
233| ERROR_CODE_RES_REF_TOO_MUCH | Resource referenced cyclically.|
234| ERROR_CODE_RES_ID_FORMAT_ERROR | Failed to format the resource obtained based on the specified resource ID.|
235| ERROR_CODE_RES_NAME_FORMAT_ERROR | Failed to format the resource obtained based on the specified resource name.|
236| ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED | Failed to access system resources.|
237| ERROR_CODE_OVERLAY_RES_PATH_INVALID | Invalid overlay path.|
238| ERROR_CODE_OUT_OF_MEMORY | Memory overflow.|
239
240
241### ScreenDensity
242
243```
244enum ScreenDensity
245```
246
247**Description**
248
249Enumerates screen density types.
250
251**Since**: 12
252
253| Value| Description|
254| -------- | -------- |
255| SCREEN_SDPI | Screen density with small-scale dots per inch (SDPI).|
256| SCREEN_MDPI | Screen density with medium-scale dots per inch (MDPI).|
257| SCREEN_LDPI | Screen density with large-scale dots per inch (LDPI).|
258| SCREEN_XLDPI | Screen density with extra-large-scale dots per inch (XLDPI).|
259| SCREEN_XXLDPI | Screen density with extra-extra-large-scale dots per inch (XXLDPI).|
260| SCREEN_XXXLDPI | Screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI).|
261
262
263## Function Description
264
265
266### OH_ResourceManager_AddResource()
267
268```
269ResourceManager_ErrorCode OH_ResourceManager_AddResource (const NativeResourceManager * mgr, const char * path )
270```
271
272**Description**
273
274Adds overlay resources when an application is running.
275
276**Since**: 12
277
278**Parameters**
279
280| Name| Description|
281| -------- | -------- |
282| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
283| path | Resource path.|
284
285**Returns**
286
287SUCCESS = 0: Operation succeeded.
288
289ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
290
291ERROR_CODE_OVERLAY_RES_PATH_INVALID 9001010 - The resource path is invalid.
292
293
294### OH_ResourceManager_GetBool()
295
296```
297ResourceManager_ErrorCode OH_ResourceManager_GetBool (const NativeResourceManager * mgr, uint32_t resId, bool * resultValue )
298```
299
300**Description**
301
302Obtains a bool value based on the specified resource ID.
303
304**Since**: 12
305
306**Parameters**
307
308| Name| Description|
309| -------- | -------- |
310| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
311| resId | Resource ID.|
312| resultValue | Result of writing **resultValue**.|
313
314**Returns**
315
316SUCCESS = 0: Operation succeeded.
317
318ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
319
320ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
321
322ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
323
324ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
325
326
327### OH_ResourceManager_GetBoolByName()
328
329```
330ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName (const NativeResourceManager * mgr, const char * resName, bool * resultValue )
331```
332
333**Description**
334
335Obtains a bool value based on the specified resource name.
336
337**Since**: 12
338
339**Parameters**
340
341| Name| Description|
342| -------- | -------- |
343| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
344| resName | Resource name.|
345| resultValue | Result of writing **resultValue**.|
346
347**Returns**
348
349SUCCESS = 0: Operation succeeded.
350
351ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
352
353ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
354
355ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
356
357ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
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**Description**
367
368Obtains a color value based on the specified resource ID.
369
370**Since**: 12
371
372**Parameters**
373
374| Name| Description|
375| -------- | -------- |
376| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
377| resId | Resource ID.|
378| resultValue | Result of writing **resultValue**.|
379
380**Returns**
381
382SUCCESS = 0: Operation succeeded.
383
384ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
385
386ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
387
388ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
389
390ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
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**Description**
400
401Obtains a color value based on the specified resource ID.
402
403**Since**: 12
404
405**Parameters**
406
407| Name| Description|
408| -------- | -------- |
409| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
410| resName | Resource name.|
411| resultValue | Result of writing **resultValue**.|
412
413**Returns**
414
415SUCCESS = 0: Operation succeeded.
416
417ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
418
419ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
420
421ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
422
423ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
424
425
426### OH_ResourceManager_GetConfiguration()
427
428```
429ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration (const NativeResourceManager * mgr, ResourceManager_Configuration * configuration )
430```
431
432**Description**
433
434Obtains the device configuration.
435
436After using this API, you need to call **OH_ResourceManager_ReleaseConfiguration()** to release the memory. If the **ResourceManager_Configuration** object is created by using malloc, call **free()** to release the object.
437
438**Since**: 12
439
440**Parameters**
441
442| Name| Description|
443| -------- | -------- |
444| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
445| configuration | Device configuration.|
446
447**Returns**
448
449SUCCESS = 0: Operation succeeded.
450
451ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
452
453ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED 9001009 - Failed to access system resources.
454
455ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
465
466Obtains singular and plural strings based on the specified resource ID.
467
468After using this API, you need to call **free()** to release the memory of the strings.
469
470**Since**: 18
471
472**Parameters**
473
474| Name| Description|
475| -------- | -------- |
476| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager). |
477| resId | Resource ID. |
478| num | Quantity value (a floating point number), Its string representation is obtained based on the current language's plural rules. |
479| resultValue | Result of writing **resultValue**. |
480| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float. |
481
482**Returns**
483
484SUCCESS = 0: Operation succeeded.
485
486ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
487
488ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
489
490ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
491
492ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
493
494ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
503
504Obtains singular and plural strings based on the specified resource name.
505
506After using this API, you need to call **free()** to release the memory of the strings.
507
508**Since**: 18
509
510**Parameters**
511
512| Name| Description|
513| -------- | -------- |
514| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager). |
515| resName | Resource name. |
516| num | Quantity value (a floating point number), The string representation is obtained based on the current language's plural rules. |
517| resultValue | Result of writing **resultValue**. |
518| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float. |
519
520**Returns**
521
522SUCCESS = 0: Operation succeeded.
523
524ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
525
526ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
527
528ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
529
530ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
531
532ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
542
543Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.
544
545**Since**: 12
546
547**Parameters**
548
549| Name| Description|
550| -------- | -------- |
551| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
552| resId | Resource ID.|
553| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
554| type | Icon type. The value **0** indicates an application icon, and the value **1** indicates a theme icon.|
555| drawableDescriptor | Result of writing **drawableDescriptor**.|
556
557**Returns**
558
559SUCCESS = 0: Operation succeeded.
560
561ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
562
563ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
564
565ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource 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
574Description
575
576Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.
577
578**Since**: 12
579
580**Parameters**
581
582| Name| Description|
583| -------- | -------- |
584| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
585| resName | Resource name.|
586| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
587| type | Icon type. This parameter is optional. The value **0** indicates an application icon, the value **1** indicates a theme icon, and the value **2** indicates a dynamic icon.|
588| drawableDescriptor | Result of writing **drawableDescriptor**.|
589
590**Returns**
591
592SUCCESS = 0: Operation succeeded.
593
594ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
595
596ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
597
598ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
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**Description**
608
609Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.
610
611**Since**: 12
612
613**Parameters**
614
615| Name| Description|
616| -------- | -------- |
617| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
618| resId | Resource ID.|
619| drawableDescriptor | Result of writing **drawableDescriptor**.|
620| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
621| type | Icon type. This parameter is optional. The value **0** indicates an application icon, and the value **1** indicates a theme icon. If this parameter is not required, set it to **0**.|
622
623**Returns**
624
625SUCCESS = 0: Operation succeeded.
626
627ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
628
629ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
630
631ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource 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**Description**
641
642Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.
643
644**Since**: 12
645
646**Parameters**
647
648| Name| Description|
649| -------- | -------- |
650| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
651| resName | Resource name.|
652| drawableDescriptor | Result of writing **drawableDescriptor**.|
653| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
654| type | Icon type. This parameter is optional. The value **0** indicates an application icon, and the value **1** indicates a theme icon. If this parameter is not required, set it to **0**.|
655
656**Returns**
657
658SUCCESS = 0: Operation succeeded.
659
660ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
661
662ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
663
664ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
665
666
667### OH_ResourceManager_GetFloat()
668
669```
670ResourceManager_ErrorCode OH_ResourceManager_GetFloat (const NativeResourceManager * mgr, uint32_t resId, float * resultValue )
671```
672
673**Description**
674
675Obtains a float value based on the specified resource ID.
676
677**Since**: 12
678
679**Parameters**
680
681| Name| Description|
682| -------- | -------- |
683| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
684| resId | Resource ID.|
685| resultValue | Result of writing **resultValue**.|
686
687**Returns**
688
689SUCCESS = 0: Operation succeeded.
690
691ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
692
693ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
694
695ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
696
697ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
698
699
700### OH_ResourceManager_GetFloatByName()
701
702```
703ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName (const NativeResourceManager * mgr, const char * resName, float * resultValue )
704```
705
706**Description**
707
708Obtains a float value based on the specified resource name.
709
710**Since**: 12
711
712**Parameters**
713
714| Name| Description|
715| -------- | -------- |
716| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
717| resName | Resource name.|
718| resultValue | Result of writing **resultValue**.|
719
720**Returns**
721
722SUCCESS = 0: Operation succeeded.
723
724ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
725
726ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
727
728ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
729
730ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
731
732
733### OH_ResourceManager_GetInt()
734
735```
736ResourceManager_ErrorCode OH_ResourceManager_GetInt (const NativeResourceManager * mgr, uint32_t resId, int * resultValue )
737```
738
739**Description**
740
741Obtains an int value based on the specified resource ID.
742
743**Since**: 12
744
745**Parameters**
746
747| Name| Description|
748| -------- | -------- |
749| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
750| resId | Resource ID.|
751| resultValue | Result of writing **resultValue**.|
752
753**Returns**
754
755SUCCESS = 0: Operation succeeded.
756
757ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
758
759ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
760
761ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
762
763ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
764
765
766### OH_ResourceManager_GetIntByName()
767
768```
769ResourceManager_ErrorCode OH_ResourceManager_GetIntByName (const NativeResourceManager * mgr, const char * resName, int * resultValue )
770```
771
772**Description**
773
774Obtains an int value based on the specified resource name.
775
776**Since**: 12
777
778**Parameters**
779
780| Name| Description|
781| -------- | -------- |
782| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
783| resName | Resource name.|
784| resultValue | Result of writing **resultValue**.|
785
786**Returns**
787
788SUCCESS = 0: Operation succeeded.
789
790ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
791
792ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
793
794ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
795
796ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
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**Description**
806
807Obtains singular and plural strings based on the specified resource ID.
808
809After using this API, you need to call **free()** to release the memory of the strings.
810
811**Since**: 18
812
813**Parameters**
814
815| Name| Description|
816| -------- | -------- |
817| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager). |
818| resId | Resource ID. |
819| num | Quantity value (an integer). Its string representation is obtained based on the current language's plural rules. |
820| resultValue | Result of writing **resultValue**. |
821| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float. |
822
823**Returns**
824
825SUCCESS = 0: Operation succeeded.
826
827ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
828
829ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
830
831ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
832
833ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
834
835ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
844
845Obtains singular and plural strings based on the specified resource name.
846
847After using this API, you need to call **free()** to release the memory of the strings.
848
849**Since**: 18
850
851**Parameters**
852
853| Name| Description|
854| -------- | -------- |
855| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager). |
856| resName | Resource name. |
857| num | Quantity value (an integer). Its string representation is obtained based on the current language's plural rules. |
858| resultValue | Result of writing **resultValue**. |
859| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float. |
860
861**Returns**
862
863SUCCESS = 0: Operation succeeded.
864
865ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
866
867ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
868
869ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
870
871ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
872
873ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
883
884Obtains the language list.
885
886After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of **localinfo**.
887
888**Since**: 12
889
890**Parameters**
891
892| Name| Description|
893| -------- | -------- |
894| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
895| resultValue | Result of writing **resultValue**.|
896| resultLen | Length of locales written to **resultLen**.|
897| includeSystem | Whether system resources are included. The default value is **false**. This parameter does not take effect if only system resources are involved when you query the list of locales.|
898
899**Returns**
900
901SUCCESS = 0: Operation succeeded.
902
903ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
904
905ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
915
916Obtains the language list.
917
918After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of **localinfo**.
919
920**Since**: 12
921
922**Parameters**
923
924| Name| Description|
925| -------- | -------- |
926| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
927| resultValue | Result of writing **resultValue**.|
928| resultLen | Length of locales written to **resultLen**.|
929| includeSystem | Whether system resources are included. If this parameter is not required, set it to **false**.|
930
931**Returns**
932
933SUCCESS = 0: Operation succeeded.
934
935ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
936
937ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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
946Description
947
948Obtains the content of the media resource with the specified screen density based on the specified resource ID.
949
950**Since**: 12
951
952**Parameters**
953
954| Name| Description|
955| -------- | -------- |
956| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
957| resId | Resource ID.|
958| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
959| resultValue | Result of writing **resultValue**.|
960| resultLen | Length of media written to **resultLen**.|
961
962**Returns**
963
964SUCCESS = 0: Operation succeeded.
965
966ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
967
968ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
969
970ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
971
972ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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
981Description
982
983Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.
984
985**Since**: 12
986
987**Parameters**
988
989| Name| Description|
990| -------- | -------- |
991| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
992| resId | Resource ID.|
993| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
994| resultValue | Result of writing **resultValue**.|
995| resultLen | Length of media written to **resultLen**.|
996
997**Returns**
998
999SUCCESS = 0: Operation succeeded.
1000
1001ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1002
1003ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1004
1005ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1006
1007ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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
1016Description
1017
1018Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.
1019
1020**Since**: 12
1021
1022**Parameters**
1023
1024| Name| Description|
1025| -------- | -------- |
1026| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1027| resName | Resource name.|
1028| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
1029| resultValue | Result of writing **resultValue**.|
1030| resultLen | Length of media written to **resultLen**.|
1031
1032**Returns**
1033
1034SUCCESS = 0: Operation succeeded.
1035
1036ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1037
1038ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
1039
1040ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
1041
1042ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1052
1053Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.
1054
1055**Since**: 12
1056
1057**Parameters**
1058
1059| Name| Description|
1060| -------- | -------- |
1061| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1062| resId | Resource ID.|
1063| resultValue | Result of writing **resultValue**.|
1064| resultLen | Length of media written to **resultLen**.|
1065| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
1066
1067**Returns**
1068
1069SUCCESS = 0: Operation succeeded.
1070
1071ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1072
1073ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1074
1075ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1076
1077ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1087
1088Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.
1089
1090**Since**: 12
1091
1092**Parameters**
1093
1094| Name| Description|
1095| -------- | -------- |
1096| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1097| resName | Resource name.|
1098| resultValue | Result of writing **resultValue**.|
1099| resultLen | Length of media written to **resultLen**.|
1100| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
1101
1102**Returns**
1103
1104SUCCESS = 0: Operation succeeded.
1105
1106ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1107
1108ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
1109
1110ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
1111
1112ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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
1121Description
1122
1123Obtains the content of the media resource with the specified screen density based on the specified resource name.
1124
1125**Since**: 12
1126
1127**Parameters**
1128
1129| Name| Description|
1130| -------- | -------- |
1131| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1132| resName | Resource name.|
1133| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
1134| resultValue | Result of writing **resultValue**.|
1135| resultLen | Length of media written to **resultLen**.|
1136
1137**Returns**
1138
1139SUCCESS = 0: Operation succeeded.
1140
1141ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1142
1143ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
1144
1145ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
1146
1147ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1157
1158Obtains the content of the media resource with the specified screen density based on the specified resource ID.
1159
1160**Since**: 12
1161
1162**Parameters**
1163
1164| Name| Description|
1165| -------- | -------- |
1166| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1167| resId | Resource ID.|
1168| resultValue | Result of writing **resultValue**.|
1169| resultLen | Length of media written to **resultLen**.|
1170| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
1171
1172**Returns**
1173
1174SUCCESS = 0: Operation succeeded.
1175
1176ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1177
1178ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1179
1180ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1181
1182ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1192
1193Obtains the content of the media resource with the specified screen density based on the specified resource name.
1194
1195**Since**: 12
1196
1197**Parameters**
1198
1199| Name| Description|
1200| -------- | -------- |
1201| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1202| resName | Resource name.|
1203| resultValue | Result of writing **resultValue**.|
1204| resultLen | Length of media written to **resultLen**.|
1205| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
1206
1207**Returns**
1208
1209SUCCESS = 0: Operation succeeded.
1210
1211ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1212
1213ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
1214
1215ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
1216
1217ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1227
1228Obtains singular and plural strings based on the specified resource ID.
1229
1230After using this API, you need to call **free()** to release the memory of the strings.
1231
1232**Since**: 12
1233
1234**Deprecated version**: 18
1235
1236**Substitute APIs**: [OH_ResourceManager_GetIntPluralString](#oh_resourcemanager_getintpluralstring)
1237
1238**Parameters**
1239
1240| Name| Description|
1241| -------- | -------- |
1242| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager). |
1243| resId | Resource ID. |
1244| num | Number. |
1245| resultValue | Result of writing **resultValue**. |
1246
1247**Returns**
1248
1249SUCCESS = 0: Operation succeeded.
1250
1251ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1252
1253ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1254
1255ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1256
1257ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1258
1259ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1268
1269Obtains singular and plural strings based on the specified resource name.
1270
1271After using this API, you need to call **free()** to release the memory of the strings.
1272
1273**Since**: 12
1274
1275**Deprecated version**: 18
1276
1277**Substitute APIs**: [OH_ResourceManager_GetIntPluralStringByName](#oh_resourcemanager_getintpluralstringbyname)
1278
1279**Parameters**
1280
1281| Name| Description|
1282| -------- | -------- |
1283| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager). |
1284| resName | Resource name. |
1285| num | Number. |
1286| resultValue | Result of writing **resultValue**. |
1287
1288**Returns**
1289
1290SUCCESS = 0: Operation succeeded.
1291
1292ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1293
1294ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
1295
1296ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
1297
1298ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1299
1300ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1301
1302
1303### OH_ResourceManager_GetString()
1304
1305```
1306ResourceManager_ErrorCode OH_ResourceManager_GetString (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue,  ... )
1307```
1308
1309**Description**
1310
1311Obtains a **string** resource based on the specified resource ID.
1312
1313The obtain common string resources, use **OH_ResourceManager_GetString(mgr, resId, resultValue)**. The obtain formatted string resources with the **d**, **s**, and **f** placeholders, use **OH_ResourceManager_GetString(mgr, resId, resultValue, 10, "format", 10.10)**. After using this API, you need to call **free()** to release the memory.
1314
1315**Since**: 12
1316
1317**Parameters**
1318
1319| Name| Description|
1320| -------- | -------- |
1321| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1322| resId | Resource ID.|
1323| resultValue | Result of writing **resultValue**.|
1324| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float.|
1325
1326**Returns**
1327
1328SUCCESS = 0: Operation succeeded.
1329
1330ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1331
1332ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1333
1334ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1335
1336ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1337
1338ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1348
1349Obtains a string array based on the specified resource ID.
1350
1351After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of the string array.
1352
1353**Since**: 12
1354
1355**Parameters**
1356
1357| Name| Description|
1358| -------- | -------- |
1359| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1360| resId | Resource ID.|
1361| resultValue | Result of writing **resultValue**.|
1362| resultLen | Length of **StringArray** written to **resultLen**.|
1363
1364**Returns**
1365
1366SUCCESS = 0: Operation succeeded.
1367
1368ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1369
1370ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1371
1372ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1373
1374ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1375
1376ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1386
1387Obtains a string array based on the specified resource name.
1388
1389After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of the string array.
1390
1391**Since**: 12
1392
1393**Parameters**
1394
1395| Name| Description|
1396| -------- | -------- |
1397| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1398| resName | Resource name.|
1399| resultValue | Result of writing **resultValue**.|
1400| resultLen | Length of **StringArray** written to **resultLen**.|
1401
1402**Returns**
1403
1404SUCCESS = 0: Operation succeeded.
1405
1406ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1407
1408ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
1409
1410ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
1411
1412ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1413
1414ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1415
1416
1417### OH_ResourceManager_GetStringByName()
1418
1419```
1420ResourceManager_ErrorCode OH_ResourceManager_GetStringByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue,  ... )
1421```
1422
1423**Description**
1424
1425Obtains a **string** resource based on the specified resource name.
1426
1427The obtain common string resources, use **OH_ResourceManager_GetString(mgr, resName, resultValue)**. The obtain formatted string resources with the **%d**, **%s**, and **%f** placeholders, use **OH_ResourceManager_GetString(mgr, resName, resultValue, 10, "format", 10.10)**. After using this API, you need to call **free()** to release the memory.
1428
1429**Since**: 12
1430
1431**Parameters**
1432
1433| Name| Description|
1434| -------- | -------- |
1435| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1436| resName | Resource name.|
1437| resultValue | Result of writing **resultValue**.|
1438| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float.|
1439
1440**Returns**
1441
1442SUCCESS = 0: Operation succeeded.
1443
1444ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1445
1446ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
1447
1448ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
1449
1450ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1451
1452ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
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**Description**
1462
1463Obtains a **symbol** resource based on the specified resource ID.
1464
1465**Since**: 12
1466
1467**Parameters**
1468
1469| Name| Description|
1470| -------- | -------- |
1471| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1472| resId | Resource ID.|
1473| resultValue | Result of writing **resultValue**.|
1474
1475**Returns**
1476
1477SUCCESS = 0: Operation succeeded.
1478
1479ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1480
1481ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1482
1483ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1484
1485ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
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**Description**
1495
1496Obtains a **symbol** resource based on the specified resource name.
1497
1498**Since**: 12
1499
1500**Parameters**
1501
1502| Name| Description|
1503| -------- | -------- |
1504| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1505| resName | Resource name.|
1506| resultValue | Result of writing **resultValue**.|
1507
1508**Returns**
1509
1510SUCCESS = 0: Operation succeeded.
1511
1512ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1513
1514ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
1515
1516ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
1517
1518ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1519
1520
1521### OH_ResourceManager_ReleaseConfiguration()
1522
1523```
1524ResourceManager_ErrorCode OH_ResourceManager_ReleaseConfiguration (ResourceManager_Configuration * configuration)
1525```
1526
1527**Description**
1528
1529Releases the memory requested by using **OH_ResourceManager_GetConfiguration()**.
1530
1531**Since**: 12
1532
1533**Parameters**
1534
1535| Name| Description|
1536| -------- | -------- |
1537| configuration | Configuration object whose memory needs to be released.|
1538
1539**Returns**
1540
1541SUCCESS = 0: Operation succeeded.
1542
1543ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1544
1545
1546### OH_ResourceManager_ReleaseStringArray()
1547
1548```
1549ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray (char *** resValue, uint32_t len )
1550```
1551
1552**Description**
1553
1554Releases the memory of the string array.
1555
1556**Since**: 12
1557
1558**Parameters**
1559
1560| Name| Description|
1561| -------- | -------- |
1562| resValue | String array whose memory needs to be released.|
1563| len | Length of the string array.|
1564
1565**Returns**
1566
1567SUCCESS = 0: Operation succeeded.
1568
1569ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1570
1571
1572### OH_ResourceManager_RemoveResource()
1573
1574```
1575ResourceManager_ErrorCode OH_ResourceManager_RemoveResource (const NativeResourceManager * mgr, const char * path )
1576```
1577
1578**Description**
1579
1580Removes overlay resources when an application is running.
1581
1582**Since**: 12
1583
1584**Parameters**
1585
1586| Name| Description|
1587| -------- | -------- |
1588| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1589| path | Resource path.|
1590
1591**Returns**
1592
1593SUCCESS = 0: Operation succeeded.
1594
1595ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1596
1597ERROR_CODE_OVERLAY_RES_PATH_INVALID 9001010 - The resource path is invalid.
1598