Skip to content

Instantly share code, notes, and snippets.

@jasonpolites
Created August 8, 2011 22:57
Show Gist options
  • Save jasonpolites/1132965 to your computer and use it in GitHub Desktop.
Save jasonpolites/1132965 to your computer and use it in GitHub Desktop.
Socialize SDK Android - Comments
import com.socialize.Socialize;
import com.socialize.entity.Comment;
import com.socialize.error.SocializeException;
import com.socialize.listener.comment.CommentAddListener;
if(Socialize.getSocialize().isAuthenticated()) {
// Add a comment to an entity
Socialize.getSocialize().addComment("http://someurl.com", "My comment text", new CommentAddListener() {
public void onError(SocializeException error) {
// Handle error
}
public void onCreate(Comment comment) {
// Handle success
}
});
}
import com.socialize.Socialize;
import com.socialize.entity.Comment;
import com.socialize.error.SocializeException;
import com.socialize.listener.comment.CommentGetListener;
if(Socialize.getSocialize().isAuthenticated()) {
// Get a single comment based on its numeric ID
Socialize.getSocialize().getCommentById(1234, new CommentGetListener() {
public void onError(SocializeException error) {
// Handle error
}
public void onGet(Comment entity) {
// Handle success
}
});
}
import com.socialize.Socialize;
import com.socialize.entity.Comment;
import com.socialize.entity.ListResult;
import com.socialize.error.SocializeException;
import com.socialize.listener.comment.CommentListListener;
if(Socialize.getSocialize().isAuthenticated()) {
// List comments for an entity with pagination (start and end index)
Socialize.getSocialize().listCommentsByEntity("http://someurl.com", 0, 100, new CommentListListener() {
public void onError(SocializeException error) {
// Handle error
}
public void onList(ListResult<Comment> result) {
// Handle success
}
});
}
import com.socialize.Socialize;
import com.socialize.entity.Comment;
import com.socialize.entity.ListResult;
import com.socialize.error.SocializeException;
import com.socialize.listener.comment.CommentListListener;
if(Socialize.getSocialize().isAuthenticated()) {
// List comments for an entity without pagination (maximum 100 will be returned)
Socialize.getSocialize().listCommentsByEntity("http://someurl.com", new CommentListListener() {
public void onError(SocializeException error) {
// Handle error
}
public void onList(ListResult<Comment> result) {
// Handle success
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment