ContextMenu contextMenu = new ContextMenu();
MenuItem lastActivityMenuItem = new MenuItem("Get last activity");
lastActivityMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
LastActivityManager lastActivityManager = xmppSession.getExtensionManager(LastActivityManager.class);
try {
lastActivityManager.getLastActivity(item.contact.get().getJid().withResource("test"));
} catch (XmppException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
});