TextView tvBalAchieve = (TextView) rootView.findViewById(R.id.tvBalAchieve);
我从sqlite数据库中检索了一些数据(那些是整数)并减去它们在文本视图中设置结果,如下所示。
tvBalAchieve.setText(Integer.toString(lstTargetAchieveVal.get(0).getTargetVal() - lstTargetAchieveVal.get(0).getAchievedVal()));
这里lstTargetAchieveVal
是一个对象数组列表。这是我的实体类细分。
public class WMTargetExecAchieveSummary {
private int targetVol;
private int targetVal;
private int achievedVol;
private int achievedVal;
private int returnVol;
private int returnVal;
private String updatedOn;
public int getTargetVol() {
return targetVol;
}
public void setTargetVol(int targetVol) {
this.targetVol = targetVol;
}
public int getTargetVal() {
return targetVal;
}
public void setTargetVal(int targetVal) {
this.targetVal = targetVal;
}
public int getAchievedVol() {
return achievedVol;
}
public void setAchievedVol(int achievedVol) {
this.achievedVol = achievedVol;
}
public int getAchievedVal() {
return achievedVal;
}
public void setAchievedVal(int achievedVal) {
this.achievedVal = achievedVal;
}
这不会给出任何错误消息。但结果是lstTargetAchieveVal.get(0).getTargetVal().
实际上它不是减法的。我在onCreateView方法(片段内)中执行所有这些操作。任何人都可以非常友好地解释这里发生了什么,我该如何纠正它。