我创建了一个包含名为DEM的类的jar文件。 DEM类有一个构造函数,它接受String参数。当我将该jar文件导入Android App并使用字符串参数初始化构造函数时,我会收到 以下错误
Error:(563, 75) error: incompatible types: String cannot be converted to boolean
我没有任何布尔构造函数。如何解决这个问题?
构造:
public DEM(String fms1) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 21; j++) {
this.mInputHistoryArray[i][j] = Double.NaN;
}
}
this.inputHistory(this.mInputHistoryArray);
String[] splittedFMS1 = fms1.split(",");
this.mInputUpdateArray[0] = TimeUtils.getTSSec() - this.mStartTime;
this.mInputUpdateArray[1] = Double.valueOf(splittedFMS1[4]);
this.mInputUpdateArray[2] = Double.valueOf(splittedFMS1[7]);
this.mInputUpdateArray[3] = Double.valueOf(splittedFMS1[3]);
this.mInputUpdateArray[4] = Double.valueOf(splittedFMS1[5]);
this.mInputUpdateArray[5] = Double.NaN;
this.mInputUpdateArray[6] = Double.NaN;
this.mInputUpdateArray[7] = Double.valueOf(splittedFMS1[8]);
this.mInputUpdateArray[8] = Double.valueOf(splittedFMS1[9]);
this.inputUpdate(this.mInputUpdateArray);
this.mOutputUpdateArray = this.outputUpdate();
mOutputHistoryArray = this.outputHistory();
}
调用构造函数:
private BroadcastReceiver mBCR_FULL_FMS_1_SENT = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(SPPService.SPP_SERVICE_INTENT_ACTION_FULL_FMS_1)) {
mFMSMsg1 = intent.getStringExtra(SPPService.SPP_SERVICE_INTENT_KEY_FULL_FMS_1);
//Log.i(TAG, SubTag.bullet("mBCR_FMS_MSG_1_SENT", "mFMSMsg1: " + mFMSMsg1));
DEM dem = new DEM(mFMSMsg1); //<<===this line Error:(563, 75)
}
}
}