Browse SDKs · Android
Platform
SDKsAndroid

Create a rich-text reply

Use createAdvancedQuoteMessage to create a quoted reply with rich-text entities.

Copy

Construct an advanced quoted reply message combining structured rich-text entities with a reference to a previous message. The reply body can include hyperlinks, mentions, and custom tags while displaying the quoted message's context.

Code example

RichMessage mention = new RichMessage();
mention.setType("mention");
mention.setOffset(0);
mention.setLength(6);
mention.setInfo("{\"userID\":\"user_a\"}");

Message message = OpenIMClient.getInstance().messageManager.createAdvancedQuoteMessage(
    "OpenIM proposal approved",
    originalMessage,
    Collections.singletonList(mention)
);

Parameters

ParameterTypeRequiredDescription
textStringYesText content of the reply message.
messageMessageYesThe complete historical Message object being referenced.
richMessagesList<RichMessage>YesList of structured rich-text entities within the reply text. See Create a rich-text message for details.

Return value

Returns the created Message object ready for transmission.

State changes after the call

  1. Local initialization: Initializes the local Message structure without sending data to the server.
  2. Transmission: Call Send a message to deliver the advanced quote message to a single user or group.