鸿蒙OS LauncherShortcutInfo

LauncherShortcutInfo

java.lang.Object

|—ohos.bundle.LauncherShortcutInfo

public class LauncherShortcutInfo
extends Object

提供有关从主屏幕启动的应用程序的启动器ability的快捷方式的信息。

该类提供了获取快捷方式所属应用程序的快捷方式 ID、图标和包名称的方法。

构造函数摘要

构造函数 描述
LauncherShortcutInfo(Context context, ShortcutInfo shortcutInfo) 用于创建 LauncherShortcutInfo 实例的构造函数。

方法总结

修饰符和类型 方法 描述
String getBundleName() 获取该快捷方式所属的应用程序包名称。
Element getIcon() 获取该快捷方式的图标。
ListShortcutIntent getIntents() 获取此快捷方式中包含的所有 ShortcutIntent 对象。
String getLabel() 获取该快捷方式的标签。
String getShortcutId() 获取此快捷方式的 ID。
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

构造函数详细信息

LauncherShortcutInfo

public LauncherShortcutInfo(Context context, ShortcutInfo shortcutInfo)

用于创建 LauncherShortcutInfo 实例的构造函数。

参数:

参数名称 参数描述
context 表示快捷方式的上下文对象。
shortcutInfo 指示有关快捷方式的信息。

方法详情

getShortcutId

public String getShortcutId()

获取此快捷方式的 ID。

快捷方式 ID 唯一标识快捷方式。

返回:

返回快捷方式 ID。

getBundleName

public String getBundleName()

获取该快捷方式所属的应用程序包名称。

返回:

返回应用程序的包名称。

getLabel

public String getLabel()

获取该快捷方式的标签。

快捷方式的标签是指快捷方式列表中显示的标题。

返回:

返回快捷方式标签。

getIntents

public ListShortcutIntent getIntents()

获取此快捷方式中包含的所有 ShortcutIntent 对象。

ohos.bundle.ShortcutIntent 对象用于导航到快捷方式的目标ability。

返回:

返回此快捷方式中所有 ohos.bundle.ShortcutIntent 对象的列表。

getIcon

public Element getIcon()

获取该快捷方式的图标。

快捷方式图标显示在快捷方式列表中。

返回:

返回快捷方式图标。

版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《鸿蒙OS LauncherShortcutInfo》
文章链接:https://zhuji.vsping.com/313216.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。