How to add a user in a specified group

Hi, i am fairly new in ignite realtime, and have recently started developing chat application, so here are the initial details, openfire server, android client and asmack library, have done most of the important part, now i am trying incorporate further functionalities. At the moment i am trying to add a newly created user in a specified group, for example i have used the following code to add user in the openfire server

org.jivesoftware.smack.AccountManager accountManager = connection.getAccountManager();

Map<String, String> attributes = new HashMap<String, String>();

attributes.put(“username”, username.getText().toString());

attributes.put(“password”, password.getText().toString());

attributes.put(“email”, email.getText().toString());

attributes.put(“name”, username.getText().toString());

try {

accountManager.createAccount(username.getText().toString(), password.getText().toString(), attributes);

Log.w(“NewAccountActivity”,“Account Created”);

} catch (XMPPException e) {

// TODO Auto-generated catch block