Firebase Data View image
(Check My Database Image Above) doubt in array value to display list of child using recylerview, I am getting only one child data , Any Suggestion to implement with array Adapter ?
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference restaurantsRef = rootRef.child("restaurants");
rootRef.child("maxminutes");
rootRef.child("minorder");
rootRef.child("minquaninty");
rootRef.child("imageUrl");
rootRef.child("rating");
rootRef.child("name");
ValueEventListener valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
ArrayList<RestaurantDetails> foodItems = new ArrayList<RestaurantDetails>();
for(DataSnapshot ds : dataSnapshot.getChildren()) {
RestaurantDetails restaurantDetails = ds.getValue(RestaurantDetails.class);
Log.d("TAG", restaurantDetails.getDescription());
Log.d("TAG", restaurantDetails.getImageUrl());
Log.d("TAG", restaurantDetails.getMaxminutes());
Log.d("TAG", restaurantDetails.getMinorder());
Log.d("TAG", String.valueOf(restaurantDetails.getRating()));
Log.d("TAG", restaurantDetails.getMinquaninty());
Log.d("TAG", restaurantDetails.getName());
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
restaurantsRef.addListenerForSingleValueEvent(valueEventListener);
pd.dismiss();
ArrayList <RestaurantDetails> ds = new ArrayList<RestaurantDetails>();
final ShoplistItemArrayAdapter shoplistItemArrayAdapter = new ShoplistItemArrayAdapter(shop_name_list,ds);
final RecyclerView recyclerView = findViewById(R.id.my_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(shoplistItemArrayAdapter);
for(int i=0; i<10; i++) {
ds.add(new RestaurantDetails());
}