Last active
May 17, 2019 19:48
-
-
Save senamit2708/e5831e82f7a3526306d2aa5cdc28d07e to your computer and use it in GitHub Desktop.
how to reverse array list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.addSnapshotListener(new EventListener<QuerySnapshot>() { | |
@Override | |
public void onEvent(@Nullable QuerySnapshot value, | |
@Nullable FirebaseFirestoreException e) { | |
if (e!= null){ | |
Log.w(TAG, "listen failed "+e); | |
return; | |
} | |
List<MessageModel> messageList = new ArrayList<>(); | |
for (DocumentSnapshot doc : value){ | |
String message = doc.getString("msg"); | |
String time = doc.getString("tme"); | |
String id = doc.getString("id"); | |
Log.i(TAG,"loaded "+message); | |
messageList.add(new MessageModel(message, time, id)); | |
} | |
Collections.reverse(messageList); | |
mMessageListLive.setValue(messageList); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment