J2ME GPS定位JSR 179实例2(3)
} // end method pauseApp
protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
// TODO 自動產生方法 Stub
} // end method destroyApp
public void commandAction(Command c, Displayable arg1)
{
if (c == exitCmd)
{
try
{
destroyApp(false);
}
catch (MIDletStateChangeException exception)
{
System.out.println("MIDletStateChangeException");
}
notifyDestroyed();
}
} // end method commandAction
public String formatDouble(double value, int decimals)
{
String doubleStr = "" + value;
int index = doubleStr.indexOf(".") != -1 ? doubleStr.indexOf(".")
: doubleStr.indexOf(",");
// Decimal point can not be found...
if (index == -1)
{
return doubleStr;
}
// Truncate all decimals
if (decimals == 0)
{
return doubleStr.substring(0, index);
}
int len = index + decimals + 1;
if (len >= doubleStr.length())
{
len = doubleStr.length();
}
double d = Double.parseDouble(doubleStr.substring(0, len));
return String.valueOf(d);
} // end method formatDouble
public void locationUpdated(LocationProvider lp, final Location location)
{
new Thread()
{
public void run()
{
相关新闻>>
- 发表评论
-
- 最新评论 更多>>