powered by Jive Software

How to update account attributes?

Hello,how could i update account attributes ,such as name,email. i see a example before. it seems not available any more .

AccountManager am = getConnection().getAccountManager();

Iterator iterator = am.getAccountAttributes().iterator();

HashMap map = new HashMap();

while(iterator.hasNext()){

String name = (String)iterator.next();

map.put(name, am.getAccountAttribute(name));

}

map.put(“email”, "test@address.com");

map.put(“name”, “test”);

Registration registration = new Registration();

registration.setType(IQ.Type.SET);

registration.setFrom(getConnection().getUser());

registration.setTo(getConnection().getHost());

registration.setAttributes(map);

try {

getConnection().sendPacket(registration);

result = true;

} catch (Exception e) {

e.printStackTrace();

}

this is my code.

With Smack 4:

AccountManager am = AccountManager.getInstance(connection)

for (String attribute : am.getAccountAttributes()) {

}