roster.getEntry(String User) return null?

Presence ps = roster.getPresence(XMPPAddress);

RosterEntry entry = roster.getEntry(XMPPAddress);

ps doesn’'t return a null pointer,but entry does.

Why? How to overcome this problem?

Presence ps = roster.getPresence(XMPPAddress);

RosterEntry entry = roster.getEntry(XMPPAddress);

ps doesn’'t return a null pointer,but entry does.

Why? How to overcome this problem?

Try using a bare XMPPAddress, without the Resource part.