最近我需要修改一个程序来添加一些新功能。该程序用于收集移动设备周围的信息,并将其发送到用户定义的服务器或将数据存储在SD卡上。但是,如果我们不自己设置服务器主机,则应用程序在运行时会每5秒显示一次敬酒:localhost/127.0.0.1:5001 – Connection refused
。Toast从哪里来?
有谁知道我怎么能知道这个面包从何而来?由于代码中有很多地方,我们有toast.show()
。
在此先感谢!
这是可能导致问题的可能的代码片段。
/**
* Update GPS Status
*/
public void updateGpsStatus(Context context, Handler handler) {
try {
LocationManager locationManager = (LocationManager) context
.getSystemService(Context.LOCATION_SERVICE);
this.gpsStatus = locationManager
.isProviderEnabled(LocationManager.GPS_PROVIDER);
} catch (Exception e) {
if (handler == null) {
ComFunc.showToast(context, e.getMessage());
} else {
ComFunc.showToast(context, e.getMessage(), handler);
}
e.printStackTrace();
}
}
这可能是由异常俘获进来的网络连接方式(通过上下文判断)之一。 – MByD 2011-04-10 09:52:05
在日志输出中寻找线索? 'adb logcat' – 2011-04-10 09:53:50
抱歉水晶球坏了。向我们显示代码,我们可以提供帮助。 – 2011-04-10 09:55:30