Skip to main content

Add Comment

The LikeMinds Android Feed SDK, users can engage in interactive discussions by adding comments to posts. This enables users to express their thoughts, ask questions, and engage with other members in a dynamic and collaborative manner.

Steps to add a comment on post

  1. Create a AddCommentRequest object using AddCommentRequest.Builder class by passing all the required parameters.
  2. Call addComment() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<AddCommentResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of AddCommentRequest
val addCommentRequest = AddCommentRequest.Builder()
.postId("ENTER COMMENT ID") // id of the post on which member has commented
.text("ENTER REPLY TEXT") // comment text
.tempId("ENTER COMMENT TEMPORARY ID") // temporary id of the comment
.build()
// get response (LMResponse<AddCommentResponse>)
val response = LMFeedClient.getInstance().addComment(addCommentRequest)
if (response.success) {
// your function to process the response dataa
processAddCommentResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Additional Features

Tag a User

To tag a user, use the getTaggingList() function to fetch the list of users that can be tagged, and use the format <<[user.name]|route://user_profile/[user.sdkClientInfo.uuid]>> to embed it inside the text of the comment.

Models

AddCommentRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdStringID of the post on which member has commented.
textStringText content of the comment.

AddCommentResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
commentCommentObject of the added comment.
usersMap<String, User>Map of user unique id to user object.