Browse SDKs · Android
SDKsAndroid

Create a rich-text reply

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

Copy

A rich-text reply stores the reply text, the quoted message, and the RichMessage entity ranges in the reply text.

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 agreed",
    originalMessage,
    Collections.singletonList(mention)
);

Every entity range must match the final reply text. Use the same application protocol for type, url, and info as described in Create a rich-text message. This method only creates an object waiting to be sent.