同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import resmgr from '@ohos.resmgr';
None.
Obtains the ResourceManager object of the current application.
Parameters
Indicates the callback containing the ResourceManager object. |
Return Values
None.
Example
resmgr.getResourceManager((error, mgr) => {
// callback
mgr.getString(0x1000000, (error, value) => {
if (error != null) {
console.log(value);
} else {
console.log(value);
}
});
// promise
mgr.getString(0x1000000).then(value => {
console.log(value);
}).catch(error => {
console.log("getstring promise " + error);
});
}
Obtains the ResourceManager object of the specified application.
Parameters
Indicates the callback containing the ResourceManager object. |
Return Values
None.
Example
resmgr.getResourceManager("com.example.myapplication", (error, mgr) => {
}
Obtains the ResourceManager object of the current application.
Parameters
None.
Return Values
Promise<ResourceManager> |
Indicates that the ResourceManager object is returned in Promise mode. |
Example
resmgr.getResourceManager().then(mgr => {
// callback
mgr.getString(0x1000000, (error, value) => {
if (error != null) {
console.log(value);
} else {
console.log(value);
}
});
// promise
mgr.getString(0x1000000).then(value => {
console.log(value);
}).catch(error => {
console.log("getstring promise " + error);
});
}).catch(error => {
});
Obtains the ResourceManager object of the specified application.
Parameters
Return Values
Promise<ResourceManager> |
Indicates that the ResourceManager object is returned in Promise mode. |
Example
resmgr.getResourceManager("com.example.myapplication").then(mgr => {
}).catch(error => {
});
Enumerates screen directions
Enumerates device types.
Enumerates screen density types.
Returns an error if an exception is thrown during execution; returns an empty value otherwise. |
|||
Returns a T object if the execution is successful; returns an empty value otherwise. |
Provides the device configuration.
Indicates the current system language, for example, zh-Hans-CN. |
Provides the device capability.
Provides the capability of accessing application resources.
Obtains the character string corresponding to a specified resource ID in callback mode.
Parameters
AsyncCallback<string> |
Indicates the asynchronous callback used to return the obtained character string. |
Return Values
None.
Obtains string resources associated with a specified resource ID in Promise mode.
Parameters
Return Values
Indicates the character string corresponding to the resource ID. |
Obtains the array of character strings corresponding to a specified resource ID in callback mode.
Parameters
AsyncCallback<Array<string>> |
Indicates the asynchronous callback used to return the obtained array of character strings. |
Return Values
None.
Obtains the array of character strings corresponding to a specified resource ID in Promise mode.
Parameters
Return Values
Indicates the array of character strings corresponding to the specified resource ID. |
Obtains the content of the media file corresponding to a specified resource ID in callback mode.
Parameters
AsyncCallback<Array<Uint8Array>> |
Indicates the asynchronous callback used to return the obtained media file content. |
Return Values
None.
Obtains the content of the media file corresponding to a specified resource ID in Promise mode.
Parameters
Return Values
Indicates the content of the media file corresponding to the specified resource ID. |
Obtains the Base64 code of the image resource corresponding to the specified resource ID in callback mode.
Parameters
AsyncCallback<string> |
Indicates the asynchronous callback used to return the obtained Base64 code of the image resource. |
Return Values
None.
Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode.
Parameters
Return Values
Indicates the Base64 code of the image resource corresponding to the specified resource ID. |
Obtains the device configuration in callback mode.
Parameters
Indicates the asynchronous callback used to return the obtained device configuration. |
Return Values
None.
Obtains the device configuration in Promise mode.
Parameters
None.
Return Values
Promise<Configuration> |
Obtains the device capability in callback mode.
Parameters
Indicates the asynchronous callback used to return the obtained device capability. |
Return Values
None.
Obtains the device capability in Promise mode.
Parameters
None.
Return Values
Promise<DeviceCapability> |
Return Values
None.
Obtains the singular-plural character string represented by the ID string corresponding to the specified number in callback mode.
Parameters
AsyncCallback<string> |
Indicates the asynchronous callback used to return the singular-plural character string represented by the ID string corresponding to the specified number. |
Return Values
None.
Obtains the singular-plural character string represented by the ID string corresponding to the specified number in Promise mode.
Parameters
Return Values
Indicates the singular-plural character string represented by the ID string corresponding to the specified number. |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。