Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. mRootChild.addListenerForSingleValueEvent(new ValueEventListener() {
  2. @Override
  3. public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  4. //Para que no repita información, cada vez que se accede al menú se borra el
  5. // ArrayList que contiene la información y solo mostrar la adecuada
  6. items.clear();
  7. int subCadenaFechaDia=0,subCadenaFechaMes=0;
  8. String nombre=null,fecha=null,descripcion=null,imagen=null,web=null;
  9. int i = 1;
  10. for(DataSnapshot postSnapshot: dataSnapshot.getChildren()){
  11.  
  12. for(DataSnapshot child: postSnapshot.getChildren()){
  13. //Log.d("VALOR","LOS HIJOS TIENE "+child.getValue());
  14. if(child.getKey().equals("Nombre") )
  15. nombre =child.getValue().toString();
  16. if(child.getKey().equals("Fecha"))
  17. fecha =child.getValue().toString();
  18. if(child.getKey().equals("Descripcion") )
  19. descripcion =child.getValue().toString();
  20. if(child.getKey().equals("Imagen") )
  21. imagen =child.getValue().toString();
  22. if(child.getKey().equals("Web") )
  23. web =child.getValue().toString();
  24.  
  25. }
  26. DatosComunes.DatosFiestas item = new DatosComunes.DatosFiestas(i,nombre, descripcion, imagen, null,fecha, web);
  27. items.add(item);
  28. i++;
  29. }
  30. //pasoDatosRecycler(items);
  31. }
  32.  
  33. @Override
  34. public void onCancelled(@NonNull DatabaseError databaseError) {
  35.  
  36. }
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement