I use the following code to add a timestamp to a message:
Map<String, Object> postValues = post.toMap();
postValues.put("timeStamp", ServerValue.TIMESTAMP);
On the client side two timestamp values are printed out (one for the local creation date and one for the value from the server I think). How do I only print out the value which came from the server?
Side-note for Frank: The code below is called when the user presses the 'send' button. Thus, the messageViewHolder gets updated twice in my app (see related question). The viewHolder is updated once with the local time estimate and once with the server time. I want it to update the holder only with the server time (once) for practical purposes.
FriendlyMessage friendlyMessage = new FriendlyMessage("bla","bla","bla");
String key = mFirebaseDatabaseReference.child(MESSAGES_CHILD).push().getKey();
Map<String, Object> postValues = friendlyMessage.toMap();
postValues.put("creationDate", ServerValue.TIMESTAMP);
childUpdates.put("/"+MESSAGES_CHILD+"/" + key, postValues);
Map<String, Object> childUpdates = new HashMap<>();
mFirebaseDatabaseReference.updateChildren(childUpdates);