I have created an "Order Placed" database and retrieved values in it from two model classes. I want to show the product details according to the order ids and the user details of the user to the admin in recycler view. Please help. Not able to retrieve this database in the recycler view. I am attaching the pic of my database. Please help. I am new in this.
EDIT: ADDING THE CODE. IT'S NOT RETRIEVING THE DATA.
List<product_details> list = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_user_products_display);
// Assign id to RecyclerView.
recyclerView = (RecyclerView) findViewById(R.id.recyclerView3);
recyclerView.setHasFixedSize(true);
FAuth = FirebaseAuth.getInstance();
currentuser = FAuth.getCurrentUser().getUid();
recyclerView.setLayoutManager(newLinearLayoutManager(AdminUserProductsDisplay.this));
AData = FirebaseDatabase.getInstance().getReference("Orders Placed").child(currentuser);
AData.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
product_details imageUploadInfo = postSnapshot.getValue(product_details.class);
list.add(imageUploadInfo);
}
adapter = new com.example.ecom.AdminUserProductRecycler(getApplicationContext(), list);
recyclerView.setAdapter(adapter);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}