在 Facebook 聊天中获取用户 ID 而不是用户名
我可以使用 Smack 集成 Facebook 聊天。我得到了我的朋友列表,但都是他们的用户 ID,而不是他们的名字。
以下是获取好友列表的代码
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());
}
。Gtalk 的相同代码给出了姓名。 http://developers.facebook.com 上没有提及它。
如何将名册视图设置为使用名称而不是用户 ID?
有没有办法检索名称而不是用户 ID?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的问题标题似乎与正文内容相反 - 在 facebook 聊天中获取用户 ID 而不是用户名
请花时间输入完整的单词和连贯的句子并格式化您的问题 - 这表明您愿意投入努力提问,这使得有人更有可能努力回答。它还可以让您更轻松地理解您要问的内容。我必须读你的问题 5 遍才能浏览所有...和???并弄清楚您遇到的问题是什么。
回答您的问题 -
RosterEntry#getName()
如查看文档所示。Your question title seems to be the opposite of what the body says - Getting user id s instead of user names in facebook chat
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.
To answer your question -
RosterEntry#getName()
as a look at the documentation would have shown.您可以尝试以下
另请参阅
You can try following
See Also