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?
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.