GoogleTalk Roster Problem

Hi

I tried to make my GoogleTalk Messanger using Smack-2.2.0.

But, Here are some problems.

Roster roster = con.getRoster();

Iterator its = roster.getEntries();

while(its.hasNext()) {

RosterEntry entry = (RosterEntry) its.next();

entry.getUser() //It is Right

entry.getName() //Problem is this line

//Some person shows his name, but some person can’'t

//show his nickname whether he logined, or not.[/i]

//Return value is null.

}

What’'s wrong?

Message was edited by: zodiac3539

Message was edited by: zodiac3539

The method RosterEntry#getName() will return the associated name of the RosterEntry, however if there isnt one then it will return null.

Therefore, best to check if its null before trying to display it. You could do

if(RosterEntry#getName() == null)

// then set a name for it

RosterEntry#setName(Name)

/code