Answer the question
In order to leave comments, you need to log in
Question about smack library (java xmpp)?
I just can not find how to put the list of contacts into a string array. In the code below, I can quietly print the entire list of contacts. But here's how to do it as a string array.
The documentation is silent, there is only code for printing. If you use a loop, then it starts over, because for (RosterEntry r: entries) itself is a loop
XMPPConnection xmpp = new XMPPConnection("gmail.com");<br/>
try {<br/>
xmpp.connect();<br/>
xmpp.login("user", "pass");<br/>
<br/>
Roster roster = xmpp.getRoster();<br/>
for(RosterEntry entry:roster.getEntries()){<br/>
Roster roster1 = xmpp.getRoster();<br/>
Collection entries = roster1.getEntries();<br/>
for(RosterEntry r:entries)<br/>
{<br/>
System.out.println(r.getUser())); <br/>
}<br/>
}<br/>
} catch (XMPPException e) {<br/>
e.printStackTrace();<br/>
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question