I have a model class which looks like this:
public class ListModel {
private String listName;
@ServerTimestamp
private Date date;
public ListModel() {}
public ListModel(String listName) {this.listName = listName;}
//setters and getters
}
This is how I add a list
to database:
ListModel listModel = new ListModel(listName);
listsRef.document(listId).set(listModel);
When I look into the database, my date looks like this:
To display the name
and the date
of the list, I'm using a FirestoreRecyclerAdapter
and a RecyclerView
. The problem is when I add a list, the name is displayed instantly but the date is displayed first as null
and only after one or two seconds is displayed correctly.
I know that the date is generated server side, but how can I display the date correctly from the first time?