I'm working with firebase and I need to sort things saved by timestamp. I tried to make an orderByValue, but I do not know how to deal with it. How can I do this?
String emailUsuario = autenticacao.getCurrentUser().getEmail();
String idUsuario = CustomBase64.codificarBase64( emailUsuario );
historicoRef = firebaseRef.child("historico").child( idUsuario );
valueEventListenerFavoritos = historicoRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
capitulos.clear();
if(dataSnapshot.getValue() != null) {
for (DataSnapshot dSnapshot : dataSnapshot.getChildren()) {
for (DataSnapshot dados : dSnapshot.getChildren()) {
final Capitulos capitulos2 = dados.getValue(Capitulos.class);
capitulos.add(capitulos2);
//progressBar.setVisibility(View.GONE);
}
}
} else {
//textFavoritos.setText("Favorite um mangá");
//progressBar.setVisibility(View.GONE);
}
adapterHistorico.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});