Friendlychat - date in messages

Asked

Viewed 42 times

0

I implemented in my Android Studio project the Friendlychat available in codelab. But there’s no date and time in the messages. How to Implement the Date and Time in this Project?

In this link are the codes of Friendly Chat

Someone could help me ?

1 answer

2

First, you would have to edit the class FriendlyMessage and place an attribute that supports Date and Time information. The Class Calendar or Date are great for this. Here are more information for the class Calendar. Do the get and set methods as you have for the other attributes.

Then you will have to include in the layout of the messages, item_message, one TextView to display the date and time. You will also need to change the Message Adapter to display the information correctly.

Then you just change the method populateViewHolder() to define the TextView date with the method of capturing the date of FriendlyMessage.

If everything doesn’t work, see how it shows the messages and the name and try to copy the method to date.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.