鴻蒙OS LauncherShortcutInfo

2022-04-25 16:59 更新

LauncherShortcutInfo

java.lang.Object

|---ohos.bundle.LauncherShortcutInfo

  1. public class LauncherShortcutInfo
  2. extends Object

提供有關(guān)從主屏幕啟動的應(yīng)用程序的啟動器ability的快捷方式的信息。

該類提供了獲取快捷方式所屬應(yīng)用程序的快捷方式 ID、圖標和包名稱的方法。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
LauncherShortcutInfo(Context context, ShortcutInfo shortcutInfo) 用于創(chuàng)建 LauncherShortcutInfo 實例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
String getBundleName() 獲取該快捷方式所屬的應(yīng)用程序包名稱。
Element getIcon() 獲取該快捷方式的圖標。
ListShortcutIntent getIntents() 獲取此快捷方式中包含的所有 ShortcutIntent 對象。
String getLabel() 獲取該快捷方式的標簽。
String getShortcutId() 獲取此快捷方式的 ID。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構(gòu)造函數(shù)詳細信息

LauncherShortcutInfo

public LauncherShortcutInfo(Context context, ShortcutInfo shortcutInfo)

用于創(chuàng)建 LauncherShortcutInfo 實例的構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context 表示快捷方式的上下文對象。
shortcutInfo 指示有關(guān)快捷方式的信息。

方法詳情

getShortcutId

public String getShortcutId()

獲取此快捷方式的 ID。

快捷方式 ID 唯一標識快捷方式。

返回:

返回快捷方式 ID。

getBundleName

public String getBundleName()

獲取該快捷方式所屬的應(yīng)用程序包名稱。

返回:

返回應(yīng)用程序的包名稱。

getLabel

public String getLabel()

獲取該快捷方式的標簽。

快捷方式的標簽是指快捷方式列表中顯示的標題。

返回:

返回快捷方式標簽。

getIntents

public ListShortcutIntent getIntents()

獲取此快捷方式中包含的所有 ShortcutIntent 對象。

ohos.bundle.ShortcutIntent 對象用于導(dǎo)航到快捷方式的目標ability。

返回:

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

getIcon

public Element getIcon()

獲取該快捷方式的圖標。

快捷方式圖標顯示在快捷方式列表中。

返回:

返回快捷方式圖標。

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號