我尝试创建/检索隐私列表但我得到NullPointerException
。我正在使用ejabberd xmpp服务器。
这里是我的代码。
String listName = "newList";
// Create the list of PrivacyItem that will allow or deny some privacy aspect
String user = "tybalt@example.com";
String groupName = "enemies";
ArrayList privacyItems = new ArrayList();
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.toString(), true, 1);
item.setValue(user);
privacyItems.add(item);
// Get the privacy manager for the current connection.
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(connection);
// Create the new list.
privacyManager.createPrivacyList(listName, privacyItems);