A
A
Artouiros2011-05-17 15:34:50
Java
Artouiros, 2011-05-17 15:34:50

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(&quot;gmail.com&quot;);<br/>
 try {<br/>
 xmpp.connect();<br/>
 xmpp.login(&quot;user&quot;, &quot;pass&quot;);<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 question

Ask a Question

731 491 924 answers to any question