W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
java.lang.Object
|---ohos.event.notification.NotificationRequest.NotificationContent
public static final class NotificationRequest.NotificationContent
extends Object
implements Sequenceable
設置要傳遞給 NotificationRequest#setContent(NotificationRequest.NotificationContent) 方法的通知內(nèi)容。 內(nèi)容類型可以是 NotificationRequest.NotificationNormalContent、NotificationRequest.NotificationLongTextContent 或 NotificationRequest.NotificationPictureContent。 您可以使用此類的構(gòu)造函數(shù)來指定要使用的類型。
Since:
1
從接口 ohos.utils.Sequenceable 繼承的嵌套類/接口 |
---|
Sequenceable.ProducerT |
修飾符和類型 | 字段 | 描述 |
---|---|---|
static int | NOTIFICATION_CONTENT_BASIC_TEXT | 表示基本通知。 |
static int | NOTIFICATION_CONTENT_CONVERSATION | 表示包含多個用戶之間對話的通知。 |
static int | NOTIFICATION_CONTENT_LONG_TEXT | 表示包含長文本的通知。 |
static int | NOTIFICATION_CONTENT_MEDIA | 表示包含媒體播放會話的通知。 |
static int | NOTIFICATION_CONTENT_MULTILINE | 表示包含多行獨立文本的通知。 |
static int | NOTIFICATION_CONTENT_PICTURE | 表示包含圖片的通知。 |
static Sequenceable.ProducerNotificationRequest.NotificationContent | PRODUCER | 從 Parcel 創(chuàng)建 NotificationContent 實例。 |
構(gòu)造函數(shù) | 描述 |
---|---|
NotificationContent(NotificationRequest.NotificationConversationalContent conversationContent) | 用于創(chuàng)建 NotificationRequest.NotificationConversationalContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_CONVERSATION(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。 |
NotificationContent(NotificationRequest.NotificationLongTextContent longTextContent) | 用于創(chuàng)建 NotificationRequest.NotificationLongTextContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_LONG_TEXT(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。 |
NotificationContent(NotificationRequest.NotificationMediaContent mediaContent) | 用于創(chuàng)建 NotificationRequest.NotificationMediaContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_MEDIA(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。 |
NotificationContent(NotificationRequest.NotificationMultiLineContent multiLineContent) | 用于創(chuàng)建 NotificationRequest.NotificationMultiLineContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_CONVERSATION(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。 |
NotificationContent(NotificationRequest.NotificationNormalContent normalContent) | 用于創(chuàng)建 NotificationRequest.NotificationNormalContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_BASIC_TEXT(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。 |
NotificationContent(NotificationRequest.NotificationPictureContent pictureContent) | 用于創(chuàng)建 NotificationRequest.NotificationPictureContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_PICTURE(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。 |
修飾符和類型 | 方法 | 描述 |
---|---|---|
int | getContentType() | 獲取通知內(nèi)容的類型值。 |
Object | getNotificationContent() | 獲取與當前通知內(nèi)容匹配的對象。 |
boolean | marshalling(Parcel out) | 將 NotificationContent 對象編組到 Parcel 中。 |
String | toString() | 返回對象的字符串表示形式。 |
boolean | unmarshalling(Parcel in) | 從 Parcel 中解組 NotificationContent 對象。 |
從類 java.lang.Object 繼承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
從接口 ohos.utils.Sequenceable 繼承的方法 |
---|
hasFileDescriptor |
public static final int NOTIFICATION_CONTENT_BASIC_TEXT
表示基本通知。 此類通知是使用 NotificationRequest.NotificationNormalContent 創(chuàng)建的。
public static final int NOTIFICATION_CONTENT_CONVERSATION
表示包含多個用戶之間對話的通知。 此類通知是使用 NotificationRequest.NotificationConversationalContent 創(chuàng)建的。
public static final int NOTIFICATION_CONTENT_LONG_TEXT
表示包含長文本的通知。 此類通知是使用 NotificationRequest.NotificationLongTextContent 創(chuàng)建的。
public static final int NOTIFICATION_CONTENT_MEDIA
表示包含媒體播放會話的通知。 此類通知是使用 NotificationRequest.NotificationMediaContent 創(chuàng)建的。
public static final int NOTIFICATION_CONTENT_MULTILINE
表示包含多行獨立文本的通知。 此類通知是使用 NotificationRequest.NotificationMultiLineContent 創(chuàng)建的。
public static final int NOTIFICATION_CONTENT_PICTURE
表示包含圖片的通知。 此類通知是使用 NotificationRequest.NotificationPictureContent 創(chuàng)建的。
public static final Sequenceable.ProducerNotificationRequest.NotificationContent PRODUCER
從 Parcel 創(chuàng)建 NotificationContent 實例。
Since:
4
public NotificationContent(NotificationRequest.NotificationNormalContent normalContent)
用于創(chuàng)建 NotificationRequest.NotificationNormalContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_BASIC_TEXT(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
normalContent | 指示 NotificationRequest.NotificationNormalContent 對象。 |
Since:
1
public NotificationContent(NotificationRequest.NotificationLongTextContent longTextContent)
用于創(chuàng)建 NotificationRequest.NotificationLongTextContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_LONG_TEXT(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
longTextContent | 指示 NotificationRequest.NotificationLongTextContent 對象。 |
Since:
1
public NotificationContent(NotificationRequest.NotificationPictureContent pictureContent)
用于創(chuàng)建 NotificationRequest.NotificationPictureContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_PICTURE(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
pictureContent | 指示 NotificationRequest.NotificationPictureContent 對象。 |
Since:
1
public NotificationContent(NotificationRequest.NotificationConversationalContent conversationContent)
用于創(chuàng)建 NotificationRequest.NotificationConversationalContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_CONVERSATION(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
conversationContent | 指示 NotificationRequest.NotificationConversationalContent 對象。 |
Since:
3
public NotificationContent(NotificationRequest.NotificationMultiLineContent multiLineContent)
用于創(chuàng)建 NotificationRequest.NotificationMultiLineContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_CONVERSATION(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
multiLineContent | 指示 NotificationRequest.NotificationMultiLineContent 對象。 |
Since:
3
public NotificationContent(NotificationRequest.NotificationMediaContent mediaContent)
用于創(chuàng)建 NotificationRequest.NotificationMediaContent 實例(通過調(diào)用 getNotificationContent() 獲得)并將內(nèi)容類型設置為 NOTIFICATION_CONTENT_MEDIA(通過調(diào)用 getContentType() 獲得)的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
mediaContent | 指示 NotificationRequest.NotificationMediaContent 對象。 |
Since:
3
public int getContentType()
獲取通知內(nèi)容的類型值。
返回:
返回當前內(nèi)容的類型值,可以是 NOTIFICATION_CONTENT_BASIC_TEXT、NOTIFICATION_CONTENT_LONG_TEXT、NOTIFICATION_CONTENT_PICTURE、NOTIFICATION_CONTENT_CONVERSATION、NOTIFICATION_CONTENT_MULTILINE 或 NOTIFICATION_CONTENT_MEDIA。
Since:
1
public Object getNotificationContent()
獲取與當前通知內(nèi)容匹配的對象。
返回:
返回內(nèi)容對象,可以是 NotificationRequest.NotificationLongTextContent、NotificationRequest.NotificationNormalContent、NotificationRequest.NotificationPictureContent、NotificationRequest.NotificationConversationalContent、NotificationRequest.NotificationMultiLineContent 或 NotificationRequest.NotificationMediaContent。
Since:
1
public boolean marshalling(Parcel out)
將 NotificationContent 對象編組到 Parcel 中。
進程可以調(diào)用 unmarshalling(ohos.utils.Parcel) 方法從 Parcel 中解組 NotificationContent 對象以實現(xiàn)進程間通信 (IPC)。
指定者:
接口 Sequenceable 中的編組
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
out | 指示用于編組的 Parcel 對象。 |
返回:
如果編組成功,則返回 true; 否則返回 false。
Since:
1
public boolean unmarshalling(Parcel in)
從 Parcel 中解組 NotificationContent 對象。
指定者:
在接口 Sequenceable 中解組
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
in | 指示用于解組的 Parcel 對象。 |
返回:
如果解組成功,則返回 true; 否則返回 false。
Since:
1
public String toString()
從類復制的描述:對象
返回對象的字符串表示形式。 通常,toString 方法返回一個“以文本方式表示”該對象的字符串。 結(jié)果應該是一個簡潔但信息豐富的表示,易于人們閱讀。 建議所有子類重寫此方法。
Object 類的 toString 方法返回一個字符串,該字符串由對象作為其實例的類的名稱、at 符號字符“@”和對象哈希碼的無符號十六進制表示形式組成。 換句話說,此方法返回一個等于以下值的字符串:
getClass().getName() + '@' + Integer.toHexString(hashCode())
覆蓋:
類 Object 中的 toString
返回:
對象的字符串表示形式。
Since:
4
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: