1

I wanted to show in the List the servers Timestamp (actually the date). The FirestoreRecyclerAdapter is feeded by this class (only kept the timestamp related methods):

public class Lista {
    private Long timestamp;
    //private Map<String, String> timestamp;

    public Lista() {
        //empty constructor needed
    }

    public Lista(Long timestamp) {
        this.timestamp = timestamp;
        //this.timestamp = timestamp;
    }

    public java.util.Map<String, String> getTimestamp() {
        return ServerValue.TIMESTAMP;
    }
    @Exclude
    public Long getTimestampLong() {
        return timestamp;
    }
}

the FirebaseListAdapter is used to populate a ListView using data present in the Firebase realtime database.

Edit1:

I forgot the question:

Has anyone done that in an Adapter? How can that be solved?

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
user1616685
  • 1,310
  • 1
  • 15
  • 36

1 Answers1

1

The ServerValue.TIMESTAMP is used when setting the timestamp in a Firebase realtime database, while in Cloud Firestore (which is a different product), we are using FieldValue.serverTimestamp(), as explained in my answer from this post.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193