我需要帮助弄清楚为什么这段代码给了我:
标记“:”上的语法错误,{ 预期在此标记之后/第 108,109,110 行(开头的 label125,label192,label202)/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 语句而不是 break and continue 可以做得更好。我对此感到沮丧,并希望得到任何建议。