i'm trying to inflate a CardView
with information taken from FireBase
. My problem is that the reference to the database read it but the RecyclerView
miss to get it... I'm new on Android, i'll aprecite so much your help.
This is my Java Class:
public class ResumenActivity extends AppCompatActivity {
DatabaseReference refMV;
RecyclerView recyclerViewResumen;
ArrayList<Listado> listaResumen;
AdaptadorResumen adaptadorResumen;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_resumen);
recyclerViewResumen = (RecyclerView) findViewById(R.id.listadoRecyclerView);
recyclerViewResumen.setLayoutManager(new LinearLayoutManager(this));
refMV.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
listaResumen = new ArrayList<Listado>();
Listado l = dataSnapshot.getValue(Listado.class);
listaResumen.add(l);
adaptadorResumen = new AdaptadorResumen(ResumenActivity.this, listaResumen);
recyclerViewResumen.setAdapter(adaptadorResumen);
recyclerViewResumen.setHasFixedSize(true);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(ResumenActivity.this, "Upss.. Algo anda mal!", Toast.LENGTH_SHORT).show();
}
});
}
}
This is the Model:
package app.technologias8.smartbarprototipo.modelos;
public class Listado {
private String Nombre;
private String Precio;
public Listado() {
}
public Listado(String nombre, String precio) {
this.Nombre = nombre;
this.Precio = precio;
}
public String getNombre() {
return this.Nombre;
}
public void setNombre(String nombre) {
this.Nombre = nombre;
}
public String getPrecio() {
return this.Precio;
}
public void setPrecio(String precio) {
this.Precio = precio;
}
}
The Firebase: