Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

Publish comment

Roman Kushnarenko edited this page Oct 29, 2014 · 2 revisions

Initialize callback listener:

OnPublishListener onPublishListener = new OnPublishListener() {
	@Override
	public void onComplete(String postId) {
		Log.i(TAG, "Published successfully");
	}

	/* 
	 * You can override other methods here: 
	 * onThinking(), onFail(String reason), onException(Throwable throwable)
	 */
};

Comment with text

Build comment:

Comment comment = new Score.Comment()
	.setMessage("Test comment")
	.build();

Publish comment:

String postId = ...;
mSimpleFacebook.publish(postId, comment, onPublishListener);

And, the result is:

Published comment text

Comment with image

Build comment:

Comment comment = new Score.Comment()
	.setAttachmentImageUrl("https://raw.githubusercontent.com/wiki/sromku/android-simple-facebook/images/publish_feed.png")
	.build();

Publish comment:

String postId = ...;
mSimpleFacebook.publish(postId, comment, onPublishListener);

And, the result is:

Published comment text

Clone this wiki locally