Retrieve room property

0 votes
I encounter problem of retreive data of room properties. here is my coding.

private LinkedHashMap<String, User> userMap = new LinkedHashMap<String, User>();

User user = new User("from hong kong"); userMap.put(Util.userName, user);
HashMap<String, Object> table = new HashMap<String, Object>(); table.put("userMap", userMap); theClient.updateRoomProperties(roomId, table, null);

After I update the room properties,  I call the getLiveRoomInfo method  and i can retreive the room property named  "userMap", but it returns userMap={hhh=fyp.caspar.taxifeesharing.realtimematching.User@4393e3c8}. How can i retrieve the field of the object user?

 

 

asked Jan 4, 2017 in Android by Caspar Chan (10 points)

1 Answer

0 votes

Hi Caspar,

Greetings from ShepHertz!!!!

Apology for deplay.

Yes, You can update the Room Properties using the API you are using, and can fetch the same.

As you are putting User object directly in the map collection, it will putting the hashCode of that User Class in the hashMap. So thats the reason while fetching the same you are getting hasCode of your Object.

I would suggest you to either override toString method in your User Class or put the data in String Object format so that you can retrieve the same. You can also use the JSON Object.

Let me know if it helps.

Thanks

Vishnu Garg

answered Jan 6, 2017 by Vishnu Garg (674 points)
Yes. override the tostring method of the object class is work. I did it yesterday. Using JSON is also a good choice. Thanks.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...