我需要帮助弄清楚这段代码给我的原因:
令牌“:”上的语法错误,{此令牌/行后的预期 108,109,110(标签125,标签192,开头的标签202)/ Java问题
public void onGPSUpdate(Location paramLocation)
{
if (paramLocation != null)
{
this.sampleCount = (1 + this.sampleCount);
label125: int i;
label192: int j;
label202: int m;
if (paramLocation.hasSpeed())
{
this.speed = (2.23693629D * paramLocation.getSpeed());
this.oldLocation = paramLocation;
this.mAvgSum += this.speed;
this.speedQ.add(Double.valueOf(this.speed));
if (this.speedQ.size() > 300)
this.mAvgSum -= ((Double)this.speedQ.remove()).doubleValue();
if (!this.speedQ.isEmpty())
break label324;
this.mAvg = 0.0D;
if (this.speed <= this.speedThreshold)
break label363;
this.THRESHOLD_STATUS = ("OVER: " + this.speedThreshold + " MPH");
if (!this.smsControlRunning)
{
smsControlOn();
this.smsControlRunning = true;
}
if (!this.blueToothPaired)
break label346;
i = 0;
if (!this.hasBlueTooth)
break label351;
j = 0;
int k = i | j;
if (!this.phoneControlRunning)
break label357;
m = 0;
label218: if ((k & m) != 0)
{
phoneControlOn();
this.phoneControlRunning = true;
}
}
while (true)
{
this.SPEED_STATUS = String.valueOf(this.speed);
this.COUNT_STATUS = (this.sampleCount + " updates");
this.MAVG_STATUS = ("mAvg: " + this.mAvg);
return;
this.speed = getSpeed(this.oldLocation, paramLocation);
break;
label324: this.mAvg = (this.mAvgSum / this.speedQ.size());
break label125;
label346: i = 1;
break label192;
label351: j = 1;
break label202;
label357: m = 1;
break label218;
label363: this.THRESHOLD_STATUS = ("UNDER: " + this.speedThreshold + " MPH");
stopAllServices();
}
}
Toast.makeText(this, "LOCATION NULL", 0).show();
}
这可能是一个明显的错误,但我对Android开发和使用Eclipse相对较新。在重命名(重构)应用程序之前,相同的代码在先前版本下工作正常。这是由另一位在我之前从事该项目的程序员编写的,我认为使用case或switch语句可以更好地完成,而不是中断和继续。我对它感到沮丧,并希望得到任何建议。
答案 0 :(得分:0)
尝试将这些标签用于“真实”代码行。 你在变量声明中使用它们,所以没有真正的意义。
使用像...这样的东西。
int i;
int j;
int m;
label125: i=0;
label192: j=0;
label202: m=0;
if (paramLocation.hasSpeed())