Doubt regarding ContactGroups and ContactItems

Hi all,

Can anyone tell me how to create new ContactGroup in the ContactList. From my understanding the APIs are exposed to create a new ContactGroup under the existing contact groups (i.e., creating subgroups). Is there any way to create new contactgroup in the contactlist which is at the top level (i.e., at the level where the default group ‘‘Friends’’ exist)?

When I create a new subgroup under one of the existing contactgroups, I could not get any of the functionalities that are available for the groups which are created using GUI (i.e., for the existing groups, not programmatically). By functionalities, i mean here, like chatting, broadcasting message, add contact, delete contact etc… the options which will come when u right click on the contact group. Also, If I add a contactitem to the newly created group, the popup options which i get in the original group, i could not see any of those options available for the newly added contactitem, if I remove the contactitem from the original group and add it to newly created group. How to get those predefined options (popup menu options) to the newly created contactgroups and contact items?

Thanks in advance…

Try something like this

String groupName = “My New Group”;

SessionManager session = SparkManager.getSessionManager();

XMPPConnection connection = session.getConnection();

RosterGroup group = connection.getRoster().getGroup(groupName);

if (group == null)

group = connection.getRoster().createGroup(groupName);

Dan.