powered by Jive Software

AccountManager creating new accounts?

Hello,

I am developing an application using the Smack API. I am already familiar with most of its features. I have successully use thed createAccount(String username, String password) method, but I would like to store another string variable with this. I have experimented with the create account method that uses a Map Object in its constructor…createAccount(String username, String password, Map attributes) . I have had little success with this. Can someone post the proper way to use this method? (ie) putting values in the attributes, as well as retrieving an attribute…Or possibly an alternate way (something besides rewriting another constructor to use)

thanks in advance

Well if you want to use the create account method and supply some attributes you just need to pass in a Map

HashMap<String, String>  atts = new HashMap<String, String>(); atts.put("FirstName", "Bob");
atts.put("Surname", "Smith"); AccountManager manager = new AcccountManager();
manager.createAccount("username", "password", atts);

Some of the syntax might be a bit off as I haven’'t written Java for a bit but the above should be okay to give you the idea.

Check out the Java tutorial on Maps

http://java.sun.com/docs/books/tutorial/collections/interfaces/map.html

hth

Jon

thanks jon…got it to work

good to hear