Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mRootChild.addListenerForSingleValueEvent(new ValueEventListener() {
- @Override
- public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
- //Para que no repita información, cada vez que se accede al menú se borra el
- // ArrayList que contiene la información y solo mostrar la adecuada
- items.clear();
- int subCadenaFechaDia=0,subCadenaFechaMes=0;
- String nombre=null,fecha=null,descripcion=null,imagen=null,web=null;
- int i = 1;
- for(DataSnapshot postSnapshot: dataSnapshot.getChildren()){
- for(DataSnapshot child: postSnapshot.getChildren()){
- //Log.d("VALOR","LOS HIJOS TIENE "+child.getValue());
- if(child.getKey().equals("Nombre") )
- nombre =child.getValue().toString();
- if(child.getKey().equals("Fecha"))
- fecha =child.getValue().toString();
- if(child.getKey().equals("Descripcion") )
- descripcion =child.getValue().toString();
- if(child.getKey().equals("Imagen") )
- imagen =child.getValue().toString();
- if(child.getKey().equals("Web") )
- web =child.getValue().toString();
- }
- DatosComunes.DatosFiestas item = new DatosComunes.DatosFiestas(i,nombre, descripcion, imagen, null,fecha, web);
- items.add(item);
- i++;
- }
- //pasoDatosRecycler(items);
- }
- @Override
- public void onCancelled(@NonNull DatabaseError databaseError) {
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement