当我将productQuantity String更改为整数应用程序崩溃时遇到问题,我无法理解错误,但他将我带到这里:
holder.quantity.setText(currentItem.getProductQuantity());
当我施法时setText(currentItem.getProductQuantity())它不起作用
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;
}
}
而这个onBindView方法
@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());
}
大话西游666
叮当猫咪
相关分类