I have a problem when I change productQuantity String to integer the app crash and I can not understand the error but he lead me to here:
holder.quantity.setText(currentItem.getProductQuantity());
when I cast setText(currentItem.getProductQuantity())
it does not work
package com.original.original.original.admin;
public class ProductItem {
String productName;
String productCode;
String productBuyPrice;
String productSalePrice;
int productQuantity;
private String key;
public ProductItem() {
}
public ProductItem(String productName, String productCode, String productBuyPrice, String productSalePrice, int productQuantity) {
this.productName = productName;
this.productCode = productCode;
this.productBuyPrice = productBuyPrice;
this.productSalePrice = productSalePrice;
this.productQuantity = productQuantity;
}
// @Exclude
public String getKey() {
return key;
}
// @Exclude
public void setKey(String key) {
this.key = key;
}
public String getProductCode() {
return productCode;
}
public String getProductName() {
return productName;
}
public String getProductBuyPrice() {
return productBuyPrice;
}
public String getProductSalePrice() {
return productSalePrice;
}
public int getProductQuantity() {
return productQuantity;
}
}
and this onBindView
method
@Override
public void onBindViewHolder(productViewHolder holder, int position) {
ProductItem currentItem = items.get(position);
holder.name.setText(currentItem.getProductName());
holder.code.setText(currentItem.getProductCode());
holder.buyPrice.setText(currentItem.getProductBuyPrice());
holder.salePrice.setText(currentItem.getProductSalePrice());
holder.quantity.setText(currentItem.getProductQuantity());
}