Getting the presence of a user

Hi guys,


The commented line is when I try to get the status from the roster entry and it returns a NullPointerException.

So I am tryring to get the presence of a user from a roster. It is returning an empty string. Any idea as to why that is.

Here is the code


Roster roster =

connection.getRoster(); for(RosterEntry entry : roster.getEntries()){

contacts.add(

//contacts.add(new UserContact(entry.getUser(), entry.getName(), entry.getStatus().toString()));

}

UserContact(entry.getUser(), entry.getName(),roster.getPresence(entry.getUser()).getType().toString()));

new