Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
53bfbf5d
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
53bfbf5d
编写于
11月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11582 【仅文档格式规范问题修改】API文档接口一致性规范整改
Merge pull request !11582 from maoziduanl/master
上级
48bc9862
c601ca9d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
311 addition
and
144 deletion
+311
-144
zh-cn/application-dev/reference/apis/js-apis-resource-manager.md
...pplication-dev/reference/apis/js-apis-resource-manager.md
+311
-144
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-resource-manager.md
浏览文件 @
53bfbf5d
...
...
@@ -39,6 +39,7 @@ getResourceManager(callback: AsyncCallback<ResourceManager>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------------------- |
| callback | AsyncCallback
<
[ResourceManager](#resourcemanager)
>
| 是 | callback方式返回ResourceManager对象 |
...
...
@@ -72,6 +73,7 @@ getResourceManager(bundleName: string, callback: AsyncCallback<ResourceManage
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------------------- | ---- | ----------------------------- |
| bundleName | string | 是 | 指定应用的Bundle名称 |
...
...
@@ -126,6 +128,7 @@ getResourceManager(bundleName: string): Promise<ResourceManager>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------- |
| bundleName | string | 是 | 指定应用的Bundle名称 |
...
...
@@ -149,7 +152,7 @@ getResourceManager(bundleName: string): Promise<ResourceManager>
**系统能力**
:SystemCapability.Global.ResourceManager
| 名称 |
默认
值 | 说明 |
| 名称 | 值 | 说明 |
| -------------------- | ---- | ---- |
| DIRECTION_VERTICAL | 0 | 竖屏 |
| DIRECTION_HORIZONTAL | 1 | 横屏 |
...
...
@@ -161,7 +164,7 @@ getResourceManager(bundleName: string): Promise<ResourceManager>
**系统能力**
:SystemCapability.Global.ResourceManager
| 名称 |
默认
值 | 说明 |
| 名称 | 值 | 说明 |
| -------------------- | ---- | ---- |
| DEVICE_TYPE_PHONE | 0x00 | 手机 |
| DEVICE_TYPE_TABLET | 0x01 | 平板 |
...
...
@@ -177,7 +180,7 @@ getResourceManager(bundleName: string): Promise<ResourceManager>
**系统能力**
:SystemCapability.Global.ResourceManager
| 名称 |
默认
值 | 说明 |
| 名称 | 值 | 说明 |
| -------------- | ---- | ---------- |
| SCREEN_SDPI | 120 | 小规模的屏幕密度 |
| SCREEN_MDPI | 160 | 中规模的屏幕密度 |
...
...
@@ -193,8 +196,9 @@ getResourceManager(bundleName: string): Promise<ResourceManager>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 名称 |
参数
类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------- | ----------------------- | ---- | ---- | -------- |
| direction |
[
Direction
](
#direction
)
| 是 | 否 | 当前设备屏幕方向 |
| locale | string | 是 | 否 | 当前系统语言 |
...
...
@@ -216,8 +220,9 @@ resourceManager.getResourceManager((error, mgr) => {
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 名称 |
参数
类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------- | ------------------------------- | ---- | ---- | -------- |
| screenDensity |
[
ScreenDensity
](
#screendensity
)
| 是 | 否 | 当前设备屏幕密度 |
| deviceType |
[
DeviceType
](
#devicetype
)
| 是 | 否 | 当前设备类型 |
...
...
@@ -239,11 +244,13 @@ resourceManager.getResourceManager((error, mgr) => {
**系统能力:**
SystemCapability.Global.ResourceManager
| 名称 | 类型 | 说明 |
| ------ | ------ | ------------------ |
| fd | number | rawfile的descriptor |
| offset | number | rawfile的起始偏移量 |
| length | number | rawfile的文件长度 |
**参数:**
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ---- | ---- | ------------------ |
| fd | number | 是 | 否 | rawfile的descriptor |
| offset | number | 是 | 否 | rawfile的起始偏移量 |
| length | number | 是 | 否 | rawfile的文件长度 |
## Resource<sup>9+</sup>
...
...
@@ -251,11 +258,13 @@ resourceManager.getResourceManager((error, mgr) => {
**系统能力:**
以下各项对应的系统能力均为SystemCapability.Global.ResourceManager
| 名称 | 类型 | 说明 |
| ---------- | ------ | ----------- |
| bundleName | string | 应用的bundle名称 |
| moduleName | string | 应用的module名称 |
| id | number | 资源的id值 |
**参数:**
| 名称 | 类型 | 可读 | 可写 |说明 |
| ---------- | ------ | ----- | ---- | ---------------|
| bundleName | string | 是 | 否 | 应用的bundle名称 |
| moduleName | string | 是 | 否 | 应用的module名称 |
| id | number | 是 | 否 | 资源的id值 |
## ResourceManager
...
...
@@ -277,6 +286,7 @@ getStringValue(resId: number, callback: AsyncCallback<string>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | --------------- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -288,9 +298,9 @@ getStringValue(resId: number, callback: AsyncCallback<string>): void
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
The resId invalid.
|
| 9001002 |
The resource not found by resId.
|
| 9001006 |
The resource re-ref too much.
|
| 9001001 |
If the module resId invalid.
|
| 9001002 |
If the resource not found by resId.
|
| 9001006 |
If the resource re-ref too much.
|
**示例Stage:**
```
ts
...
...
@@ -317,6 +327,7 @@ getStringValue(resId: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -328,11 +339,13 @@ getStringValue(resId: number): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -357,6 +370,7 @@ getStringValue(resource: Resource, callback: AsyncCallback<string>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | --------------- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -364,11 +378,13 @@ getStringValue(resource: Resource, callback: AsyncCallback<string>): void
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -377,7 +393,7 @@ getStringValue(resource: Resource, callback: AsyncCallback<string>): void
moduleName
:
"
entry
"
,
id
:
$r
(
'
app.string.test
'
).
id
};
t
yr
{
t
ry
{
this
.
context
.
resourceManager
.
getStringValue
(
resource
,
(
error
,
value
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error is
"
+
error
);
...
...
@@ -400,23 +416,26 @@ getStringValue(resource: Resource): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| --------------------- | ---------------- |
| Promise
<
string
>
| resource对象对应的字符串 |
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -446,6 +465,7 @@ getStringArrayValue(resId: number, callback: AsyncCallback<Array<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -453,11 +473,13 @@ getStringArrayValue(resId: number, callback: AsyncCallback<Array<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -484,6 +506,7 @@ getStringArrayValue(resId: number): Promise<Array<string>>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -495,11 +518,13 @@ getStringArrayValue(resId: number): Promise<Array<string>>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -523,6 +548,7 @@ getStringArrayValue(resource: Resource, callback: AsyncCallback<Array<stri
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -530,11 +556,13 @@ getStringArrayValue(resource: Resource, callback: AsyncCallback<Array<stri
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -565,6 +593,7 @@ getStringArrayValue(resource: Resource): Promise<Array<string>>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -576,11 +605,13 @@ getStringArrayValue(resource: Resource): Promise<Array<string>>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -601,7 +632,7 @@ getStringArrayValue(resource: Resource): Promise<Array<string>>
```
### getMediaContent
### getMediaContent
<sup>9+</sup>
getMediaContent(resId: number, callback: AsyncCallback
<
Uint8Array
>
): void
...
...
@@ -610,6 +641,7 @@ getMediaContent(resId: number, callback: AsyncCallback<Uint8Array>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------ |
| resId | number | 是 | 资源ID值 |
...
...
@@ -617,10 +649,12 @@ getMediaContent(resId: number, callback: AsyncCallback<Uint8Array>): void
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
...
...
@@ -638,7 +672,7 @@ getMediaContent(resId: number, callback: AsyncCallback<Uint8Array>): void
```
### getMediaContent
### getMediaContent
<sup>9+</sup>
getMediaContent(resId: number): Promise
<
Uint8Array
>
...
...
@@ -647,6 +681,7 @@ getMediaContent(resId: number): Promise<Uint8Array>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -658,15 +693,17 @@ getMediaContent(resId: number): Promise<Uint8Array>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
try
{
mg
r
.
getMediaContent
(
$r
(
'
app.media.test
'
).
id
).
then
(
value
=>
{
this
.
context
.
resourceManage
r
.
getMediaContent
(
$r
(
'
app.media.test
'
).
id
).
then
(
value
=>
{
let
media
=
value
;
}).
catch
(
error
=>
{
console
.
log
(
"
getMediaContent promise error is
"
+
error
);
...
...
@@ -685,6 +722,7 @@ getMediaContent(resource: Resource, callback: AsyncCallback<Uint8Array>):
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------ |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -692,10 +730,12 @@ getMediaContent(resource: Resource, callback: AsyncCallback<Uint8Array>):
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
...
...
@@ -726,6 +766,7 @@ getMediaContent(resource: Resource): Promise<Uint8Array>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -737,10 +778,12 @@ getMediaContent(resource: Resource): Promise<Uint8Array>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
...
...
@@ -761,7 +804,7 @@ getMediaContent(resource: Resource): Promise<Uint8Array>
```
### getMediaContentBase64
### getMediaContentBase64
<sup>9+</sup>
getMediaContentBase64(resId: number, callback: AsyncCallback
<
string
>
): void
...
...
@@ -770,6 +813,7 @@ getMediaContentBase64(resId: number, callback: AsyncCallback<string>): voi
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------ |
| resId | number | 是 | 资源ID值 |
...
...
@@ -777,15 +821,17 @@ getMediaContentBase64(resId: number, callback: AsyncCallback<string>): voi
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
try
{
mg
r
.
getMediaContentBase64
(
$r
(
'
app.media.test
'
).
id
,
(
error
,
value
)
=>
{
this
.
context
.
resourceManage
r
.
getMediaContentBase64
(
$r
(
'
app.media.test
'
).
id
,
(
error
,
value
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error is
"
+
error
);
}
else
{
...
...
@@ -798,7 +844,7 @@ getMediaContentBase64(resId: number, callback: AsyncCallback<string>): voi
```
### getMediaContentBase64
### getMediaContentBase64
<sup>9+</sup>
getMediaContentBase64(resId: number): Promise
<
string
>
...
...
@@ -807,6 +853,7 @@ getMediaContentBase64(resId: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -818,15 +865,17 @@ getMediaContentBase64(resId: number): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
try
{
mg
r
.
getMediaContentBase64
(
$r
(
'
app.media.test
'
).
id
).
then
(
value
=>
{
this
.
context
.
resourceManage
r
.
getMediaContentBase64
(
$r
(
'
app.media.test
'
).
id
).
then
(
value
=>
{
let
media
=
value
;
}).
catch
(
error
=>
{
console
.
log
(
"
getMediaContentBase64 promise error is
"
+
error
);
...
...
@@ -844,7 +893,8 @@ getMediaContentBase64(resource: Resource, callback: AsyncCallback<string>)
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------ |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -852,10 +902,12 @@ getMediaContentBase64(resource: Resource, callback: AsyncCallback<string>)
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
...
...
@@ -886,6 +938,7 @@ getMediaContentBase64(resource: Resource): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -897,10 +950,12 @@ getMediaContentBase64(resource: Resource): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
**示例:**
```
ts
...
...
@@ -930,6 +985,7 @@ getConfiguration(callback: AsyncCallback<Configuration>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------- |
| callback | AsyncCallback
<
[Configuration](#configuration)
>
| 是 | 异步回调,用于返回设备的Configuration |
...
...
@@ -984,6 +1040,7 @@ getDeviceCapability(callback: AsyncCallback<DeviceCapability>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback
<
[DeviceCapability](#devicecapability)
>
| 是 | 异步回调,用于返回设备的DeviceCapability |
...
...
@@ -1029,7 +1086,7 @@ getDeviceCapability(): Promise<DeviceCapability>
```
### getPluralStringValue
### getPluralStringValue
<sup>9+</sup>
getPluralStringValue(resId: number, num: number, callback: AsyncCallback
<
string
>
): void
...
...
@@ -1038,6 +1095,7 @@ getPluralStringValue(resId: number, num: number, callback: AsyncCallback<stri
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -1046,11 +1104,13 @@ getPluralStringValue(resId: number, num: number, callback: AsyncCallback<stri
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1068,7 +1128,7 @@ getPluralStringValue(resId: number, num: number, callback: AsyncCallback<stri
```
### getPluralStringValue
### getPluralStringValue
<sup>9+</sup>
getPluralStringValue(resId: number, num: number): Promise
<
string
>
...
...
@@ -1077,6 +1137,7 @@ getPluralStringValue(resId: number, num: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -1089,11 +1150,13 @@ getPluralStringValue(resId: number, num: number): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1117,6 +1180,7 @@ getPluralStringValue(resource: Resource, num: number, callback: AsyncCallback<
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------ |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -1125,11 +1189,13 @@ getPluralStringValue(resource: Resource, num: number, callback: AsyncCallback<
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1161,6 +1227,7 @@ getPluralString(resource: Resource, num: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -1173,11 +1240,13 @@ getPluralString(resource: Resource, num: number): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1207,6 +1276,7 @@ getRawFileContent(path: string, callback: AsyncCallback<Uint8Array>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ----------------------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1214,9 +1284,11 @@ getRawFileContent(path: string, callback: AsyncCallback<Uint8Array>): void
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001005 |
T
he resource not found by path. |
| 9001005 |
If t
he resource not found by path. |
**示例:**
```
ts
...
...
@@ -1243,6 +1315,7 @@ getRawFileContent(path: string): Promise<Uint8Array>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1254,9 +1327,11 @@ getRawFileContent(path: string): Promise<Uint8Array>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001005 |
T
he resource not found by path. |
| 9001005 |
If t
he resource not found by path. |
**示例:**
```
ts
...
...
@@ -1281,6 +1356,7 @@ getRawFd(path: string, callback: AsyncCallback<RawFileDescriptor>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------------------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1288,9 +1364,11 @@ getRawFd(path: string, callback: AsyncCallback<RawFileDescriptor>): void
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001005 |
T
he resource not found by path. |
| 9001005 |
If t
he resource not found by path. |
**示例:**
```
ts
...
...
@@ -1303,9 +1381,8 @@ getRawFd(path: string, callback: AsyncCallback<RawFileDescriptor>): void
let
offset
=
value
.
offset
;
let
length
=
value
.
length
;
}
});
}
catch
(
error
=>
{
console
.
log
(
"
getRawFd callback error is
"
+
error
);
}).
catch
(
error
=>
{
console
.
log
(
"
getRawFd callback error is
"
+
error
);
});
```
...
...
@@ -1318,6 +1395,7 @@ getRawFd(path: string): Promise<RawFileDescriptor>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1329,9 +1407,11 @@ getRawFd(path: string): Promise<RawFileDescriptor>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001005 |
T
he resource not found by path. |
| 9001005 |
If t
he resource not found by path. |
**示例:**
```
ts
...
...
@@ -1357,6 +1437,7 @@ closeRawFileDescriptor(path: string, callback: AsyncCallback<void>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1382,6 +1463,7 @@ closeRawFileDescriptor(path: string): Promise<void>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1412,6 +1494,7 @@ closeRawFd(path: string, callback: AsyncCallback<void>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1419,6 +1502,8 @@ closeRawFd(path: string, callback: AsyncCallback<void>): void
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001005 | The resource not found by path. |
...
...
@@ -1426,7 +1511,7 @@ closeRawFd(path: string, callback: AsyncCallback<void>): void
**示例:**
```
ts
try
{
mg
r
.
closeRawFd
(
"
test.xml
"
,
(
error
,
value
)
=>
{
this
.
context
.
resourceManage
r
.
closeRawFd
(
"
test.xml
"
,
(
error
,
value
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error is
"
+
error
);
}
...
...
@@ -1446,6 +1531,7 @@ closeRawFd(path: string): Promise<void>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -1457,14 +1543,16 @@ closeRawFd(path: string): Promise<void>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001005 |
T
he resource not found by path. |
| 9001005 |
If t
he resource not found by path. |
**示例:**
```
ts
try
{
mg
r
.
closeRawFd
(
"
test.xml
"
).
then
(
value
=>
{
this
.
context
.
resourceManage
r
.
closeRawFd
(
"
test.xml
"
).
then
(
value
=>
{
let
result
=
value
;
}).
catch
(
error
=>
{
console
.
log
(
"
closeRawFd promise error is
"
+
error
);
...
...
@@ -1498,6 +1586,7 @@ getStringByName(resName: string, callback: AsyncCallback<string>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | --------------- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1505,11 +1594,13 @@ getStringByName(resName: string, callback: AsyncCallback<string>): void
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1536,6 +1627,7 @@ getStringByName(resName: string): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1547,11 +1639,13 @@ getStringByName(resName: string): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1575,6 +1669,7 @@ getStringArrayByName(resName: string, callback: AsyncCallback<Array<string
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1582,11 +1677,13 @@ getStringArrayByName(resName: string, callback: AsyncCallback<Array<string
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1612,6 +1709,7 @@ getStringArrayByName(resName: string): Promise<Array<string>>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1623,11 +1721,13 @@ getStringArrayByName(resName: string): Promise<Array<string>>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1651,6 +1751,7 @@ getMediaByName(resName: string, callback: AsyncCallback<Uint8Array>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------ |
| resName | string | 是 | 资源名称 |
...
...
@@ -1658,11 +1759,13 @@ getMediaByName(resName: string, callback: AsyncCallback<Uint8Array>): void
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1688,6 +1791,7 @@ getMediaByName(resName: string): Promise<Uint8Array>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1699,11 +1803,13 @@ getMediaByName(resName: string): Promise<Uint8Array>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1727,6 +1833,7 @@ getMediaBase64ByName(resName: string, callback: AsyncCallback<string>): vo
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------ |
| resName | string | 是 | 资源名称 |
...
...
@@ -1734,11 +1841,13 @@ getMediaBase64ByName(resName: string, callback: AsyncCallback<string>): vo
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1764,6 +1873,7 @@ getMediaBase64ByName(resName: string): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1775,11 +1885,13 @@ getMediaBase64ByName(resName: string): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1803,6 +1915,7 @@ getPluralStringByName(resName: string, num: number, callback: AsyncCallback<s
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ----------------------------- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1811,11 +1924,13 @@ getPluralStringByName(resName: string, num: number, callback: AsyncCallback<s
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1842,6 +1957,7 @@ getPluralStringByName(resName: string, num: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1854,11 +1970,13 @@ getPluralStringByName(resName: string, num: number): Promise<string>
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1882,6 +2000,7 @@ getStringSync(resId: number): string
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -1891,6 +2010,16 @@ getStringSync(resId: number): string
| ------ | ----------- |
| string | 资源ID值对应的字符串 |
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
| 9001006 | If the resource re-ref too much. |
**示例:**
```
ts
try
{
...
...
@@ -1909,6 +2038,7 @@ getStringSync(resource: Resource): string
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -1920,11 +2050,13 @@ getStringSync(resource: Resource): string
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1949,6 +2081,7 @@ getStringByNameSync(resName: string): string
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -1960,11 +2093,13 @@ getStringByNameSync(resName: string): string
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -1984,6 +2119,7 @@ getBoolean(resId: number): boolean
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -1995,11 +2131,13 @@ getBoolean(resId: number): boolean
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -2018,6 +2156,7 @@ getBoolean(resource: Resource): boolean
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -2029,11 +2168,13 @@ getBoolean(resource: Resource): boolean
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -2058,6 +2199,7 @@ getBooleanByName(resName: string): boolean
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -2069,11 +2211,13 @@ getBooleanByName(resName: string): boolean
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -2093,6 +2237,7 @@ getNumber(resId: number): number
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2104,11 +2249,13 @@ getNumber(resId: number): number
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -2134,6 +2281,7 @@ getNumber(resource: Resource): number
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---- |
| resource |
[
Resource
](
#resource9
)
| 是 | 资源信息 |
...
...
@@ -2145,11 +2293,13 @@ getNumber(resource: Resource): number
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001001 |
T
he resId invalid. |
| 9001002 |
T
he resource not found by resId. |
| 9001006 |
T
he resource re-ref too much. |
| 9001001 |
If t
he resId invalid. |
| 9001002 |
If t
he resource not found by resId. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -2174,6 +2324,7 @@ getNumberByName(resName: string): number
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ---- |
| resName | string | 是 | 资源名称 |
...
...
@@ -2185,11 +2336,13 @@ getNumberByName(resName: string): number
以下错误码的详细介绍请参见
[
资源管理错误码
](
../errorcodes/errorcode-resource-manager.md
)
。
**错误码:**
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 9001003 |
T
he resName invalid. |
| 9001004 |
T
he resource not found by resName. |
| 9001006 |
T
he resource re-ref too much. |
| 9001003 |
If t
he resName invalid. |
| 9001004 |
If t
he resource not found by resName. |
| 9001006 |
If t
he resource re-ref too much. |
**示例:**
```
ts
...
...
@@ -2218,6 +2371,7 @@ getString(resId: number, callback: AsyncCallback<string>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | --------------- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2248,6 +2402,7 @@ getString(resId: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2280,6 +2435,7 @@ getStringArray(resId: number, callback: AsyncCallback<Array<string>>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2310,6 +2466,7 @@ getStringArray(resId: number): Promise<Array<string>>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2342,6 +2499,7 @@ getMedia(resId: number, callback: AsyncCallback<Uint8Array>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ------------------ |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2372,6 +2530,7 @@ getMedia(resId: number): Promise<Uint8Array>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2404,6 +2563,7 @@ getMediaBase64(resId: number, callback: AsyncCallback<string>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------ |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2434,6 +2594,7 @@ getMediaBase64(resId: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2466,6 +2627,7 @@ getPluralString(resId: number, num: number): Promise<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2499,6 +2661,7 @@ getPluralString(resId: number, num: number, callback: AsyncCallback<string>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------- |
| resId | number | 是 | 资源ID值 |
...
...
@@ -2530,6 +2693,7 @@ getRawFile(path: string, callback: AsyncCallback<Uint8Array>): void
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------- | ---- | ----------------------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -2560,6 +2724,7 @@ getRawFile(path: string): Promise<Uint8Array>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -2592,6 +2757,7 @@ getRawFileDescriptor(path: string, callback: AsyncCallback<RawFileDescriptor&
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------------------- |
| path | string | 是 | rawfile文件路径 |
...
...
@@ -2623,6 +2789,7 @@ getRawFileDescriptor(path: string): Promise<RawFileDescriptor>
**系统能力**
:SystemCapability.Global.ResourceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ----------- |
| path | string | 是 | rawfile文件路径 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录