提交 545033cd 编写于 作者: A annie_wangli

update docs

Signed-off-by: Nannie_wangli <annie.wangli@huawei.com>
上级 03de8509
# Resource Management Resource Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -18,12 +18,12 @@ Obtains the **ResourceManager** object of this application. This method uses a c ...@@ -18,12 +18,12 @@ Obtains the **ResourceManager** object of this application. This method uses a c
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ----------------------------- |
| callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes| Callback used to return the **ResourceManager** object obtained.| | callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes | Callback used to return the **ResourceManager** object obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
if (error != null) { if (error != null) {
...@@ -49,13 +49,13 @@ Obtains the **ResourceManager** object of an application. This method uses an as ...@@ -49,13 +49,13 @@ Obtains the **ResourceManager** object of an application. This method uses an as
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---------- | ---------------------------------------- | ---- | ----------------------------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes | Bundle name of the target application. |
| callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes| Callback used to return the **ResourceManager** object obtained.| | callback | AsyncCallback&lt;[ResourceManager](#resourcemanager)&gt; | Yes | Callback used to return the **ResourceManager** object obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager("com.example.myapplication", (error, mgr) => { resourceManager.getResourceManager("com.example.myapplication", (error, mgr) => {
}); });
...@@ -70,12 +70,12 @@ Obtains the **ResourceManager** object of this application. This method uses a p ...@@ -70,12 +70,12 @@ Obtains the **ResourceManager** object of this application. This method uses a p
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------------- | ----------------- |
| Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained.| | Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager().then(mgr => { resourceManager.getResourceManager().then(mgr => {
mgr.getString(0x1000000, (error, value) => { mgr.getString(0x1000000, (error, value) => {
...@@ -99,17 +99,17 @@ Obtains the **ResourceManager** object of an application. This method uses a pro ...@@ -99,17 +99,17 @@ Obtains the **ResourceManager** object of an application. This method uses a pro
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---------- | ------ | ---- | ------------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes | Bundle name of the target application.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------------- | ------------------ |
| Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained.| | Promise&lt;[ResourceManager](#resourcemanager)&gt; | Promise used to return the **ResourceManager** object obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager("com.example.myapplication").then(mgr => { resourceManager.getResourceManager("com.example.myapplication").then(mgr => {
...@@ -123,72 +123,82 @@ Obtains the **ResourceManager** object of an application. This method uses a pro ...@@ -123,72 +123,82 @@ Obtains the **ResourceManager** object of an application. This method uses a pro
Enumerates the screen directions. Enumerates the screen directions.
| Name| Default Value| Description| **System capability**: SystemCapability.Global.ResourceManager
| -------- | -------- | -------- |
| DIRECTION_VERTICAL | 0 | Portrait<br>**System capability**: SystemCapability.Global.ResourceManager| | Name | Default Value | Description |
| DIRECTION_HORIZONTAL | 1 | Landscape<br>**System capability**: SystemCapability.Global.ResourceManager| | -------------------- | ---- | ---- |
| DIRECTION_VERTICAL | 0 | Portrait |
| DIRECTION_HORIZONTAL | 1 | Landscape |
## DeviceType ## DeviceType
Enumerates the device types. Enumerates the device types.
| Name| Default Value| Description| **System capability**: SystemCapability.Global.ResourceManager
| -------- | -------- | -------- |
| DEVICE_TYPE_PHONE | 0x00 | Mobile phone.<br>**System capability**: SystemCapability.Global.ResourceManager| | Name | Default Value | Description |
| DEVICE_TYPE_TABLET | 0x01 | Tablet.<br>**System capability**: SystemCapability.Global.ResourceManager| | -------------------- | ---- | ---- |
| DEVICE_TYPE_CAR | 0x02 | Automobile.<br>**System capability**: SystemCapability.Global.ResourceManager| | DEVICE_TYPE_PHONE | 0x00 | Mobile phone. |
| DEVICE_TYPE_PC | 0x03 | Computer.<br>**System capability**: SystemCapability.Global.ResourceManager| | DEVICE_TYPE_TABLET | 0x01 | Tablet. |
| DEVICE_TYPE_TV | 0x04 | TV.<br>**System capability**: SystemCapability.Global.ResourceManager| | DEVICE_TYPE_CAR | 0x02 | Automobile. |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable.<br>**System capability**: SystemCapability.Global.ResourceManager| | DEVICE_TYPE_PC | 0x03 | Computer. |
| DEVICE_TYPE_TV | 0x04 | TV. |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable. |
## ScreenDensity ## ScreenDensity
Enumerates the screen density types. Enumerates the screen density types.
| Name| Default Value| Description| **System capability**: SystemCapability.Global.ResourceManager
| -------- | -------- | -------- |
| SCREEN_SDPI | 120 | Screen density with small-scale dots per inch (SDPI).<br>**System capability**: SystemCapability.Global.ResourceManager| | Name | Default Value | Description |
| SCREEN_MDPI | 160 | Screen density with medium-scale dots per inch (MDPI).<br>**System capability**: SystemCapability.Global.ResourceManager| | -------------- | ---- | ---------- |
| SCREEN_LDPI | 240 | Screen density with large-scale dots per inch (LDPI).<br>**System capability**: SystemCapability.Global.ResourceManager| | SCREEN_SDPI | 120 | Screen density with small-scale dots per inch (SDPI). |
| SCREEN_XLDPI | 320 | Screen density with extra-large-scale dots per inch (XLDPI).<br>**System capability**: SystemCapability.Global.ResourceManager| | SCREEN_MDPI | 160 | Screen density with medium-scale dots per inch (MDPI). |
| SCREEN_XXLDPI | 480 | Screen density with extra-extra-large-scale dots per inch (XXLDPI).<br>**System capability**: SystemCapability.Global.ResourceManager| | SCREEN_LDPI | 240 | Screen density with large-scale dots per inch (LDPI). |
| SCREEN_XXXLDPI | 640 | Screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI).<br>**System capability**: SystemCapability.Global.ResourceManager| | SCREEN_XLDPI | 320 | Screen density with extra-large-scale dots per inch (XLDPI). |
| SCREEN_XXLDPI | 480 | Screen density with extra-extra-large-scale dots per inch (XXLDPI). |
| SCREEN_XXXLDPI | 640 | Screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI).|
## Configuration ## Configuration
Defines the device configuration. Defines the device configuration.
**System capability**: SystemCapability.Global.ResourceManager
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | --------- | ----------------------- | ---- | ---- | -------- |
| direction | [Direction](#direction) | Yes| No| Screen direction of the device.<br>**System capability**: SystemCapability.Global.ResourceManager| | direction | [Direction](#direction) | Yes | No | Screen direction of the device.|
| locale | string | Yes| No| Current system language.<br>**System capability**: SystemCapability.Global.ResourceManager| | locale | string | Yes | No | Current system language. |
## DeviceCapability ## DeviceCapability
Defines the device capability. Defines the device capability.
**System capability**: SystemCapability.Global.ResourceManager
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | Name | Type | Readable | Writable | Description |
| screenDensity | [ScreenDensity](#screendensity) | Yes| No| Screen density of the device.<br>**System capability**: SystemCapability.Global.ResourceManager| | ------------- | ------------------------------- | ---- | ---- | -------- |
| deviceType | [DeviceType](#devicetype) | Yes| No| Type of the device.<br>**System capability**: SystemCapability.Global.ResourceManager| | screenDensity | [ScreenDensity](#screendensity) | Yes | No | Screen density of the device.|
| deviceType | [DeviceType](#devicetype) | Yes | No | Type of the device. |
## RawFileDescriptor<sup>8+</sup> ## RawFileDescriptor<sup>8+</sup>
Defines the descriptor information of the raw file. Defines the descriptor information of the raw file.<br>
<br/>**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ------ | ------ | ------------------ |
| fd | number | Descriptor of a raw file.| | fd | number | Descriptor of a raw file.|
| offset | number | Offset to the start position of the raw file.| | offset | number | Offset to the start position of the raw file. |
| length | number | Length of the raw file.| | length | number | Length of the raw file. |
## ResourceManager ## ResourceManager
...@@ -209,13 +219,13 @@ Obtains the string corresponding to the specified resource ID. This method uses ...@@ -209,13 +219,13 @@ Obtains the string corresponding to the specified resource ID. This method uses
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------- | ---- | --------------- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback used to return the string obtained.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the string obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getString($r('app.string.test').id, (error, value) => { mgr.getString($r('app.string.test').id, (error, value) => {
...@@ -237,17 +247,17 @@ Obtains the string corresponding to the specified resource ID. This method uses ...@@ -237,17 +247,17 @@ Obtains the string corresponding to the specified resource ID. This method uses
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ----- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | ----------- |
| Promise&lt;string&gt; | Promise used to return the string obtained.| | Promise&lt;string&gt; | Promise used to return the string obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getString($r('app.string.test').id).then(value => { mgr.getString($r('app.string.test').id).then(value => {
...@@ -267,13 +277,13 @@ Obtains the array of strings corresponding to the specified resource ID. This me ...@@ -267,13 +277,13 @@ Obtains the array of strings corresponding to the specified resource ID. This me
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ----------------- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes| Callback used to return the obtained array of strings.| | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the obtained array of strings.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getStringArray($r('app.strarray.test').id, (error, value) => { mgr.getStringArray($r('app.strarray.test').id, (error, value) => {
...@@ -295,17 +305,17 @@ Obtains the array of strings corresponding to the specified resource ID. This me ...@@ -295,17 +305,17 @@ Obtains the array of strings corresponding to the specified resource ID. This me
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ----- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------- | ------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the array of strings obtained.| | Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the array of strings obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getStringArray($r('app.strarray.test').id).then(value => { mgr.getStringArray($r('app.strarray.test').id).then(value => {
...@@ -325,13 +335,13 @@ Obtains the content of the media file corresponding to the specified resource ID ...@@ -325,13 +335,13 @@ Obtains the content of the media file corresponding to the specified resource ID
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------------- | ---- | ------------------ |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes| Callback used to return the content of the media file obtained.| | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the content of the media file obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getMedia($r('app.media.test').id, (error, value) => { mgr.getMedia($r('app.media.test').id, (error, value) => {
...@@ -353,17 +363,17 @@ Obtains the content of the media file corresponding to the specified resource ID ...@@ -353,17 +363,17 @@ Obtains the content of the media file corresponding to the specified resource ID
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ----- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------------- | -------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the content of the media file obtained.| | Promise&lt;Uint8Array&gt; | Promise used to return the content of the media file obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getMedia($r('app.media.test').id).then(value => { mgr.getMedia($r('app.media.test').id).then(value => {
...@@ -383,13 +393,13 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. ...@@ -383,13 +393,13 @@ Obtains the Base64 code of the image corresponding to the specified resource ID.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------- | ---- | ------------------------ |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback used to return the Base64 code of the image obtained.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the Base64 code of the image obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getMediaBase64($r('app.media.test').id, (error, value) => { mgr.getMediaBase64($r('app.media.test').id, (error, value) => {
...@@ -411,17 +421,17 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. ...@@ -411,17 +421,17 @@ Obtains the Base64 code of the image corresponding to the specified resource ID.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ----- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | -------------------- |
| Promise&lt;string&gt; | Promise used to return the Base64 code of the image obtained.| | Promise&lt;string&gt; | Promise used to return the Base64 code of the image obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getMediaBase64($r('app.media.test').id).then(value => { mgr.getMediaBase64($r('app.media.test').id).then(value => {
...@@ -441,12 +451,12 @@ Obtains the device configuration. This method uses an asynchronous callback to r ...@@ -441,12 +451,12 @@ Obtains the device configuration. This method uses an asynchronous callback to r
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ------------------------- |
| callback | AsyncCallback&lt;[Configuration](#configuration)&gt; | Yes| Callback used to return the obtained device configuration.| | callback | AsyncCallback&lt;[Configuration](#configuration)&gt; | Yes | Callback used to return the obtained device configuration.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getConfiguration((error, value) => { mgr.getConfiguration((error, value) => {
...@@ -468,12 +478,12 @@ Obtains the device configuration. This method uses a promise to return the resul ...@@ -468,12 +478,12 @@ Obtains the device configuration. This method uses a promise to return the resul
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------------- | ---------------- |
| Promise&lt;[Configuration](#configuration)&gt; | Promise used to return the device configuration.| | Promise&lt;[Configuration](#configuration)&gt; | Promise used to return the device configuration.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getConfiguration().then(value => { mgr.getConfiguration().then(value => {
...@@ -493,12 +503,12 @@ Obtains the device capability. This method uses an asynchronous callback to retu ...@@ -493,12 +503,12 @@ Obtains the device capability. This method uses an asynchronous callback to retu
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback&lt;[DeviceCapability](#devicecapability)&gt; | Yes| Callback used to return the obtained device capability.| | callback | AsyncCallback&lt;[DeviceCapability](#devicecapability)&gt; | Yes | Callback used to return the obtained device capability.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getDeviceCapability((error, value) => { mgr.getDeviceCapability((error, value) => {
...@@ -520,12 +530,12 @@ Obtains the device capability. This method uses a promise to return the result. ...@@ -520,12 +530,12 @@ Obtains the device capability. This method uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------------- | ------------------- |
| Promise&lt;[DeviceCapability](#devicecapability)&gt; | Promise used to return the obtained device capability.| | Promise&lt;[DeviceCapability](#devicecapability)&gt; | Promise used to return the obtained device capability.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getDeviceCapability().then(value => { mgr.getDeviceCapability().then(value => {
...@@ -545,14 +555,14 @@ Obtains the specified number of singular-plural strings corresponding to the spe ...@@ -545,14 +555,14 @@ Obtains the specified number of singular-plural strings corresponding to the spe
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------- | ---- | ------------------------------- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID. |
| num | number | Yes| Number that determines the plural or singular form.| | num | number | Yes | Number that determines the plural or singular form. |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback used to return the singular-plural string obtained.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the singular-plural string obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getPluralString($r("app.plural.test").id, 1, (error, value) => { mgr.getPluralString($r("app.plural.test").id, 1, (error, value) => {
...@@ -574,18 +584,18 @@ Obtains the specified number of singular-plural strings corresponding to the spe ...@@ -574,18 +584,18 @@ Obtains the specified number of singular-plural strings corresponding to the spe
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ----- | ------ | ---- | ----- |
| resId | number | Yes| Resource ID.| | resId | number | Yes | Resource ID.|
| num | number | Yes| Number that determines the plural or singular form.| | num | number | Yes | Number that determines the plural or singular form. |
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | --------------------- | ------------------------- |
| Promise&lt;string&gt; | Promise used to return the singular-plural string obtained.| | Promise&lt;string&gt; | Promise used to return the singular-plural string obtained.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getPluralString($r("app.plural.test").id, 1).then(value => { mgr.getPluralString($r("app.plural.test").id, 1).then(value => {
...@@ -604,13 +614,13 @@ Obtains the content of the raw file in the specified path. This method uses an a ...@@ -604,13 +614,13 @@ Obtains the content of the raw file in the specified path. This method uses an a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------------- | ---- | ----------------------- |
| path | string | Yes| Path of the raw file.| | path | string | Yes | Path of the raw file. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes| Callback used to return the raw file content, in byte arrays.| | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the raw file content, in byte arrays.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getRawFile("test.xml", (error, value) => { mgr.getRawFile("test.xml", (error, value) => {
...@@ -631,17 +641,17 @@ Obtains the content of the raw file in the specified path. This method uses a pr ...@@ -631,17 +641,17 @@ Obtains the content of the raw file in the specified path. This method uses a pr
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Path of the raw file.| | path | string | Yes | Path of the raw file.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------------- | ----------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the raw file content, in byte arrays.| | Promise&lt;Uint8Array&gt; | Promise used to return the raw file content, in byte arrays.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getRawFile("test.xml").then(value => { mgr.getRawFile("test.xml").then(value => {
...@@ -660,13 +670,13 @@ Obtains the descriptor of the raw file in the specified path. This method uses a ...@@ -660,13 +670,13 @@ Obtains the descriptor of the raw file in the specified path. This method uses a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | -------------------------------- |
| path | string | Yes| Path of the raw file.| | path | string | Yes | Path of the raw file. |
| callback | AsyncCallback&lt;[RawFileDescriptor](#RawFileDescriptor<sup>8+</sup>)&gt; | Yes| Callback used to return the raw file descriptor.| | callback | AsyncCallback&lt;[RawFileDescriptor](#rawfiledescriptor8+</sup)&gt; | Yes | Callback used to return the raw file descriptor.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getRawFileDescriptor("test.xml", (error, value) => { mgr.getRawFileDescriptor("test.xml", (error, value) => {
...@@ -689,17 +699,17 @@ Obtains the descriptor of the raw file in the specified path. This method uses a ...@@ -689,17 +699,17 @@ Obtains the descriptor of the raw file in the specified path. This method uses a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Path of the raw file.| | path | string | Yes | Path of the raw file.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ---------------------------------------- | ------------------- |
| Promise&lt;[RawFileDescriptor](#RawFileDescriptor<sup>8+</sup>)&gt; | Promise used to return the raw file descriptor.| | Promise&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Promise used to return the raw file descriptor.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.getRawFileDescriptor("test.xml").then(value => { mgr.getRawFileDescriptor("test.xml").then(value => {
...@@ -720,13 +730,13 @@ Closes the descriptor of the raw file in the specified path. This method uses an ...@@ -720,13 +730,13 @@ Closes the descriptor of the raw file in the specified path. This method uses an
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | ------------------------- | ---- | ----------- |
| path | string | Yes| Path of the raw file.| | path | string | Yes | Path of the raw file.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.closeRawFileDescriptor("test.xml", (error, value) => { mgr.closeRawFileDescriptor("test.xml", (error, value) => {
...@@ -745,17 +755,17 @@ Closes the descriptor of the raw file in the specified path. This method uses a ...@@ -745,17 +755,17 @@ Closes the descriptor of the raw file in the specified path. This method uses a
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- **Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---- | ------ | ---- | ----------- |
| path | string | Yes| Path of the raw file.| | path | string | Yes | Path of the raw file.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | ------------------- | ---- |
| Promise&lt;void&gt; | No value is returned.| | Promise&lt;void&gt; | No value is returned.|
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.closeRawFileDescriptor("test.xml").then(value => { mgr.closeRawFileDescriptor("test.xml").then(value => {
...@@ -768,13 +778,13 @@ Closes the descriptor of the raw file in the specified path. This method uses a ...@@ -768,13 +778,13 @@ Closes the descriptor of the raw file in the specified path. This method uses a
### release<sup>7+</sup> ### release<sup>7+</sup>
release(); release()
Releases the created **resourceManager**. Releases the created **resourceManager**.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
- Example **Example**
``` ```
resourceManager.getResourceManager((error, mgr) => { resourceManager.getResourceManager((error, mgr) => {
mgr.release((error, value) => { mgr.release((error, value) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册