啪的Andr​​oid 4.1.0名册不显示 [英] Smack 4.1.0 android Roster not displaying

查看:262
本文介绍了啪的Andr​​oid 4.1.0名册不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图显示,即使它不能显示其所有可用的接触

I am trying to display all available contacts even though it is not displaying it

code:

Roster roster = Roster.getInstanceFor(connection);
Collection<RosterEntry> entries = roster.getEntries();
System.out.println("ENTRIEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESS");
int roster_counter = 0;
for (RosterEntry entry : entries) {
     roster_counter++;
     try {
         System.out.println("Here is Roster " + Integer.toString(roster_counter) + ": " + entry);
     }catch (Exception e){
           System.out.println("2222222222222222222222");
           System.out.println(e);
     }
}

输出:

04-01 18:07:41.535    2756-2776/com.example.example I/System.out﹕ ##########################################################
04-01 18:07:41.535    2756-2776/com.example.example I/System.out﹕ ====================================================
04-01 18:07:41.537    2756-2776/com.example.example I/System.out﹕ PRESSSSSEEEEEEN STABLISHEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEED

我觉得应该打印所有作品吧?但其中的印刷非。任何帮助吗?连接配置是这样的:

I think it should print all entries right? but its printing non of them. any help? The connection configuration is this:

configBuilder.setDebuggerEnabled(true);
                configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

我想AP preciate任何帮助。

I would appreciate any help.

推荐答案

我固定它添加:

if (!roster.isLoaded()) 
    roster.reloadAndWait();

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

这篇关于啪的Andr​​oid 4.1.0名册不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆