I've two api's one for retrieving list items and the other for retrieving Images based on the first api id. I'm able fetch the items and display it in recyclerview but the problem is that only for the last item in the list the image is shown
What I have tried:
First api call method that retrieves the list items and sets the items to HashMap<string,string>
for (RetrieveItemCatalogListByItemCategoryListItem items : response.body()) {
combinedHashMap = new HashMap<>();
combinedHashMap.put("ID", String.valueOf(items.getId()));
combinedHashMap.put("SUPPLIER_ID", String.valueOf(items.getiSupplierID()));
combinedHashMap.put("SUPPLIER_STORE_NAME", items.getsSupplierStoreName());
combinedHashMap.put("ITEM_CATEGORY_ID", String.valueOf(items.getiItemCategoryID()));
combinedHashMap.put("ITEM_CATEGORY", items.getsItemCategory());
combinedHashMap.put("PRODUCT_TYPE_ID", String.valueOf(items.getiProductTypeID()));
combinedHashMap.put("PRODUCT_TYPE", items.getsProductType());
combinedHashMap.put("AVAILABILITY_ID", String.valueOf(items.getiAvailabilityID()));
combinedHashMap.put("AVAILABILITY", items.getsAvailability());
combinedHashMap.put("CURRENT_STOCK", items.getsCurrentStock());
combinedHashMap.put("CURRENT_PRICE", items.getsCurrentPrice());
combinedHashMap.put("RETURN_POLICY_ID", String.valueOf(items.getiReturnPolicyID()));
combinedHashMap.put("RETURN_POLICY", items.getsReturnPolicy());
combinedHashMap.put("PRODUCT_NAME", items.getsProductName());
combinedHashMap.put("PRODUCT_SERVICE_NAME", items.getsProductServiceName());
combinedHashMap.put("PRODUCT_DESCRIPTION", items.getsProductDescription());
combinedHashMap.put("WORKFLOW_STATUS_ID", String.valueOf(items.getiWorkflowStatusID()));
combinedHashMap.put("WORKFLOW_STATUS", items.getsWorkflowStatus());
combinedHashMap.put("CREATE_DATE", items.getsCreateDate());
combinedHashMap.put("UPDATE_DATE", items.getsUpdateDate());
retrieveImageSource(items.getiSupplierID());
productMap.add(combinedHashMap);
}
Second API method to retrieve image
for (RetrieveListBySourceTypeListItem items : response.body().getResult()) {
List<HashMap<String, String>> fileMap = new ArrayList<>();
combinedHashMap.put("FILE_NAME", items.getsFileName());
combinedHashMap.put("SOURCE_ID", String.valueOf(items.getiSourceID()));
combinedHashMap.put("SOURCE_TYPE_ID", String.valueOf(items.getiSourceTypeID()));
}
Log.d("Combined_Items", productMap.toString());
binding.selectedItemsList.setAdapter(new SearchProductResultAdapter(SearchProductResultActivity.this, productMap, new SearchProductResultAdapter.OnItemClick() {
@Override
public void onClick(View view, HashMap<String, String> combinedListItem) {
if (view.getId() == R.id.layoutItem) {
String id = combinedListItem.get("ID");
startActivity(new Intent(getApplicationContext(), ShoppingCartActivity.class)
.putExtra("ID", combinedListItem.get("ID")));
}
}
}));