Search code examples
javaxmppsmackvcf-vcardfacebook-chat

Getting user id s instead of user names in facebook chat


I could integrate Facebook chat using Smack. I get my friends list but it's all their user id's and not their names.

The following is the code for getting friends list

public void displayBuddyList()
{

    Roster roster = connection.getRoster();
    Collection<RosterEntry> entries = roster.getEntries();

    System.out.println("\n\n" + entries.size() + " buddy(ies):");

    for(RosterEntry r:entries)
    {
      System.out.println(r.getUser());
    }

The same code for Gtalk gives the names. There's no mention of it on the http://developers.facebook.com.

How to I set my roster view to use names instead of user id's?

Is there any way to retrieve the names instead of user id's?


Solution

    1. Your question title seems to be the opposite of what the body says - Getting user id s instead of user names in facebook chat

    2. Please take the time to type out complete words and coherent sentences and format your question - it show that you're willing to put in effort in asking which makes it more likely someone will put in the effort to answer. It also makes it easier to understand what it is you're asking. I had to read your question 5 times before I was able to navigate my way through all the ... and ??? and figure out what it was that you were having trouble with.

    3. To answer your question - RosterEntry#getName() as a look at the documentation would have shown.

      for(RosterEntry r:entries)
      {
          System.out.println(r.getName());
      }