1e41f4b71Sopenharmony_ci# Resourcemanager
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Overview
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciProvides C APIs for obtaining resources.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci**Since**: 12
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## Summary
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci### File
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci| Name| Description| 
17e41f4b71Sopenharmony_ci| -------- | -------- |
18e41f4b71Sopenharmony_ci| [ohresmgr.h](ohresmgr_8h.md) | Provides native APIs for obtaining resources.| 
19e41f4b71Sopenharmony_ci| [resmgr_common.h](resmgr__common_8h.md) | Provides the enum types and structures for resource manager APIs.| 
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci### Enum
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| Name| Description| 
25e41f4b71Sopenharmony_ci| -------- | -------- |
26e41f4b71Sopenharmony_ci| [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.| 
27e41f4b71Sopenharmony_ci| [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.| 
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci### Callback
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci| Name| Description| 
33e41f4b71Sopenharmony_ci| -------- | -------- |
34e41f4b71Sopenharmony_ci| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetMediaBase64](#oh_resourcemanager_getmediabase64) (const 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.| 
35e41f4b71Sopenharmony_ci| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetMediaBase64ByName](#oh_resourcemanager_getmediabase64byname) (const 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.| 
36e41f4b71Sopenharmony_ci| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetMedia](#oh_resourcemanager_getmedia) (const 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.| 
37e41f4b71Sopenharmony_ci| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetMediaByName](#oh_resourcemanager_getmediabyname) (const 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.| 
38e41f4b71Sopenharmony_ci| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetDrawableDescriptor](#oh_resourcemanager_getdrawabledescriptor) (const 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.| 
39e41f4b71Sopenharmony_ci| [ResourceManager_ErrorCode](#resourcemanager_errorcode)[OH_ResourceManager_GetDrawableDescriptorByName](#oh_resourcemanager_getdrawabledescriptorbyname) (const 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.| 
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci## Enum Description
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci### ResourceManager_ErrorCode
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci```
48e41f4b71Sopenharmony_cienum ResourceManager_ErrorCode
49e41f4b71Sopenharmony_ci```
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci**Description**
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ciEnumerates resource manager error codes.
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci**Since**: 12
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci| Value| Description| 
58e41f4b71Sopenharmony_ci| -------- | -------- |
59e41f4b71Sopenharmony_ci| SUCCESS | Success.| 
60e41f4b71Sopenharmony_ci| ERROR_CODE_INVALID_INPUT_PARAMETER | Invalid input parameter.| 
61e41f4b71Sopenharmony_ci| ERROR_CODE_RES_ID_NOT_FOUND | Invalid resource ID.| 
62e41f4b71Sopenharmony_ci| ERROR_CODE_RES_NOT_FOUND_BY_ID | Invalid resource name.| 
63e41f4b71Sopenharmony_ci| ERROR_CODE_RES_NAME_NOT_FOUND | No matching resource found based on the resource ID.| 
64e41f4b71Sopenharmony_ci| ERROR_CODE_RES_NOT_FOUND_BY_NAME | No matching resource found based on the resource name.| 
65e41f4b71Sopenharmony_ci| ERROR_CODE_RES_PATH_INVALID | Invalid relative path.| 
66e41f4b71Sopenharmony_ci| ERROR_CODE_RES_REF_TOO_MUCH | Resource referenced cyclically.| 
67e41f4b71Sopenharmony_ci| ERROR_CODE_RES_ID_FORMAT_ERROR | Failed to format the resource obtained based on the specified resource ID.| 
68e41f4b71Sopenharmony_ci| ERROR_CODE_RES_NAME_FORMAT_ERROR | Failed to format the resource obtained based on the specified resource name.| 
69e41f4b71Sopenharmony_ci| ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED | Failed to access system resources.| 
70e41f4b71Sopenharmony_ci| ERROR_CODE_OVERLAY_RES_PATH_INVALID | Invalid overlay path.| 
71e41f4b71Sopenharmony_ci| ERROR_CODE_OUT_OF_MEMORY | Memory overflow.| 
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci### ScreenDensity
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci```
77e41f4b71Sopenharmony_cienum ScreenDensity
78e41f4b71Sopenharmony_ci```
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci**Description**
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ciEnumerates screen density types.
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci**Since**: 12
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci| Value| Description| 
87e41f4b71Sopenharmony_ci| -------- | -------- |
88e41f4b71Sopenharmony_ci| SCREEN_SDPI | Screen density with small-scale dots per inch (SDPI).| 
89e41f4b71Sopenharmony_ci| SCREEN_MDPI | Screen density with medium-scale dots per inch (MDPI).| 
90e41f4b71Sopenharmony_ci| SCREEN_LDPI | Screen density with large-scale dots per inch (LDPI).| 
91e41f4b71Sopenharmony_ci| SCREEN_XLDPI | Screen density with extra-large-scale dots per inch (XLDPI).| 
92e41f4b71Sopenharmony_ci| SCREEN_XXLDPI | Screen density with extra-extra-large-scale dots per inch (XXLDPI).| 
93e41f4b71Sopenharmony_ci| SCREEN_XXXLDPI | Screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI).| 
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci## Function Description
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci### OH_ResourceManager_GetDrawableDescriptor()
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci```
102e41f4b71Sopenharmony_ciResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor (const NativeResourceManager * mgr, uint32_t resId, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density = 0, uint32_t type = 0 )
103e41f4b71Sopenharmony_ci```
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci**Description**
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ciObtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci**Since**: 12
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci**Parameters**
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci| Name| Description| 
114e41f4b71Sopenharmony_ci| -------- | -------- |
115e41f4b71Sopenharmony_ci| mgr | Pointer to **NativeResourceManager**. It is obtained by using the **OH_ResourceManager_InitNativeResourceManager** API.| 
116e41f4b71Sopenharmony_ci| resId | Resource ID.| 
117e41f4b71Sopenharmony_ci| density | Screen density. If the value of **enddensity** is **0**, the current system screen density is used.| 
118e41f4b71Sopenharmony_ci| type | Icon type. The value **0** indicates an application icon, and the value **1** indicates a theme icon.| 
119e41f4b71Sopenharmony_ci| drawableDescriptor | Result of writing **drawableDescriptor**.| 
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci**Returns**
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ciSUCCESS = 0: Operation succeeded.
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ciERROR_CODE_INVALID_INPUT_PARAMETER 401: The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ciERROR_CODE_RES_ID_NOT_FOUND 9001001: The resource ID is invalid.
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ciERROR_CODE_RES_NOT_FOUND_BY_ID 9001002: No matching resource is found based on the resource ID.
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci### OH_ResourceManager_GetDrawableDescriptorByName()
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci```
135e41f4b71Sopenharmony_ciResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName (const NativeResourceManager * mgr, const char * resName, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density = 0, uint32_t type = 0 )
136e41f4b71Sopenharmony_ci```
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ciDescription
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ciObtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci**Since**: 12
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ci**Parameters**
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci| Name| Description| 
147e41f4b71Sopenharmony_ci| -------- | -------- |
148e41f4b71Sopenharmony_ci| mgr | Pointer to **NativeResourceManager**. It is obtained by using the **OH_ResourceManager_InitNativeResourceManager** API.| 
149e41f4b71Sopenharmony_ci| resName | Resource name.| 
150e41f4b71Sopenharmony_ci| density | Screen density. If the value of **enddensity** is **0**, the current system screen density is used.| 
151e41f4b71Sopenharmony_ci| type | Icon type. The value **0** indicates an application icon, the value **1** indicates a theme icon, and the value **2** indicates a dynamic icon.| 
152e41f4b71Sopenharmony_ci| drawableDescriptor | Result of writing **drawableDescriptor**.| 
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ci**Returns**
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ciSUCCESS = 0: Operation succeeded.
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ciERROR_CODE_INVALID_INPUT_PARAMETER 401: The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ciERROR_CODE_RES_NAME_NOT_FOUND 9001003: The resource name is invalid.
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ciERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004: No matching resource is found based on the resource name.
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci
165e41f4b71Sopenharmony_ci### OH_ResourceManager_GetMedia()
166e41f4b71Sopenharmony_ci
167e41f4b71Sopenharmony_ci```
168e41f4b71Sopenharmony_ciResourceManager_ErrorCode OH_ResourceManager_GetMedia (const NativeResourceManager * mgr, uint32_t resId, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
169e41f4b71Sopenharmony_ci```
170e41f4b71Sopenharmony_ci
171e41f4b71Sopenharmony_ciDescription
172e41f4b71Sopenharmony_ci
173e41f4b71Sopenharmony_ciObtains the content of the media resource with the specified screen density based on the specified resource ID.
174e41f4b71Sopenharmony_ci
175e41f4b71Sopenharmony_ci**Since**: 12
176e41f4b71Sopenharmony_ci
177e41f4b71Sopenharmony_ci**Parameters**
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci| Name| Description| 
180e41f4b71Sopenharmony_ci| -------- | -------- |
181e41f4b71Sopenharmony_ci| mgr | Pointer to **NativeResourceManager**. It is obtained by using the **OH_ResourceManager_InitNativeResourceManager** API.| 
182e41f4b71Sopenharmony_ci| resId | Resource ID.| 
183e41f4b71Sopenharmony_ci| density | Screen density. If the value of **enddensity** is **0**, the current system screen density is used.| 
184e41f4b71Sopenharmony_ci| resultValue | Result of writing **resultValue**.| 
185e41f4b71Sopenharmony_ci| resultLen | Length of media written to **resultLen**.| 
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ci**Returns**
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ciSUCCESS = 0: Operation succeeded.
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ciERROR_CODE_INVALID_INPUT_PARAMETER 401: The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ciERROR_CODE_RES_ID_NOT_FOUND 9001001: The resource ID is invalid.
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ciERROR_CODE_RES_NOT_FOUND_BY_ID 9001002: No matching resource is found based on the resource ID.
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_ciERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ci
200e41f4b71Sopenharmony_ci### OH_ResourceManager_GetMediaBase64()
201e41f4b71Sopenharmony_ci
202e41f4b71Sopenharmony_ci```
203e41f4b71Sopenharmony_ciResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64 (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
204e41f4b71Sopenharmony_ci```
205e41f4b71Sopenharmony_ci
206e41f4b71Sopenharmony_ciDescription
207e41f4b71Sopenharmony_ci
208e41f4b71Sopenharmony_ciObtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.
209e41f4b71Sopenharmony_ci
210e41f4b71Sopenharmony_ci**Since**: 12
211e41f4b71Sopenharmony_ci
212e41f4b71Sopenharmony_ci**Parameters**
213e41f4b71Sopenharmony_ci
214e41f4b71Sopenharmony_ci| Name| Description| 
215e41f4b71Sopenharmony_ci| -------- | -------- |
216e41f4b71Sopenharmony_ci| mgr | Pointer to **NativeResourceManager**. It is obtained by using the **OH_ResourceManager_InitNativeResourceManager** API.| 
217e41f4b71Sopenharmony_ci| resId | Resource ID.| 
218e41f4b71Sopenharmony_ci| density | Screen density. If the value of **enddensity** is **0**, the current system screen density is used.| 
219e41f4b71Sopenharmony_ci| resultValue | Result of writing **resultValue**.| 
220e41f4b71Sopenharmony_ci| resultLen | Length of media written to **resultLen**.| 
221e41f4b71Sopenharmony_ci
222e41f4b71Sopenharmony_ci**Returns**
223e41f4b71Sopenharmony_ci
224e41f4b71Sopenharmony_ciSUCCESS = 0: Operation succeeded.
225e41f4b71Sopenharmony_ci
226e41f4b71Sopenharmony_ciERROR_CODE_INVALID_INPUT_PARAMETER 401: The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
227e41f4b71Sopenharmony_ci
228e41f4b71Sopenharmony_ciERROR_CODE_RES_ID_NOT_FOUND 9001001: The resource ID is invalid.
229e41f4b71Sopenharmony_ci
230e41f4b71Sopenharmony_ciERROR_CODE_RES_NOT_FOUND_BY_ID 9001002: No matching resource is found based on the resource ID.
231e41f4b71Sopenharmony_ci
232e41f4b71Sopenharmony_ciERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
233e41f4b71Sopenharmony_ci
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci### OH_ResourceManager_GetMediaBase64ByName()
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci```
238e41f4b71Sopenharmony_ciResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
239e41f4b71Sopenharmony_ci```
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ciDescription
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ciObtains the Base64 code of the media resource with the specified screen density based on the specified resource name.
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci**Since**: 12
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci**Parameters**
248e41f4b71Sopenharmony_ci
249e41f4b71Sopenharmony_ci| Name| Description| 
250e41f4b71Sopenharmony_ci| -------- | -------- |
251e41f4b71Sopenharmony_ci| mgr | Pointer to **NativeResourceManager**. It is obtained by using the **OH_ResourceManager_InitNativeResourceManager** API.| 
252e41f4b71Sopenharmony_ci| resName | Resource name.| 
253e41f4b71Sopenharmony_ci| density | Screen density. If the value of **enddensity** is **0**, the current system screen density is used.| 
254e41f4b71Sopenharmony_ci| resultValue | Result of writing **resultValue**.| 
255e41f4b71Sopenharmony_ci| resultLen | Length of media written to **resultLen**.| 
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci**Returns**
258e41f4b71Sopenharmony_ci
259e41f4b71Sopenharmony_ciSUCCESS = 0: Operation succeeded. ERROR_CODE_INVALID_INPUT_PARAMETER 401: The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed. ERROR_CODE_RES_NAME_NOT_FOUND 9001003: The resource name is invalid. ERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004: No matching resource is found based on the resource name. ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ci
262e41f4b71Sopenharmony_ci### OH_ResourceManager_GetMediaByName()
263e41f4b71Sopenharmony_ci
264e41f4b71Sopenharmony_ci```
265e41f4b71Sopenharmony_ciResourceManager_ErrorCode OH_ResourceManager_GetMediaByName (const NativeResourceManager * mgr, const char * resName, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
266e41f4b71Sopenharmony_ci```
267e41f4b71Sopenharmony_ci
268e41f4b71Sopenharmony_ciDescription
269e41f4b71Sopenharmony_ci
270e41f4b71Sopenharmony_ciObtains the content of the media resource with the specified screen density based on the specified resource name.
271e41f4b71Sopenharmony_ci
272e41f4b71Sopenharmony_ci**Since**: 12
273e41f4b71Sopenharmony_ci
274e41f4b71Sopenharmony_ci**Parameters**
275e41f4b71Sopenharmony_ci
276e41f4b71Sopenharmony_ci| Name| Description| 
277e41f4b71Sopenharmony_ci| -------- | -------- |
278e41f4b71Sopenharmony_ci| mgr | Pointer to **NativeResourceManager**. It is obtained by using the **OH_ResourceManager_InitNativeResourceManager** API.| 
279e41f4b71Sopenharmony_ci| resName | Resource name.| 
280e41f4b71Sopenharmony_ci| density | Screen density. If the value of **enddensity** is **0**, the current system screen density is used.| 
281e41f4b71Sopenharmony_ci| resultValue | Result of writing **resultValue**.| 
282e41f4b71Sopenharmony_ci| resultLen | Length of media written to **resultLen**.| 
283e41f4b71Sopenharmony_ci
284e41f4b71Sopenharmony_ci**Returns**
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_ciSUCCESS = 0: Operation succeeded.
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ciERROR_CODE_INVALID_INPUT_PARAMETER 401: The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
289e41f4b71Sopenharmony_ci
290e41f4b71Sopenharmony_ciERROR_CODE_RES_NAME_NOT_FOUND 9001003: The resource name is invalid.
291e41f4b71Sopenharmony_ci
292e41f4b71Sopenharmony_ciERROR_CODE_RES_NOT_FOUND_BY_NAME 9001004: No matching resource is found based on the resource name.
293e41f4b71Sopenharmony_ci
294e41f4b71Sopenharmony_ciERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
295