onDestroy()
并不总是被调用。如果调用,则只执行部分代码。而且大多数时候在LogCat中我只看到消息“首先调用破坏时的 gps 状态”。这是为什么?
protected void onDestroy() {
super.onDestroy();
Log.d("on destroy called", "gps state on destroy called first");
editor.putBoolean("gpsOn", false);
Log.d("on destroy called", "gps state on destroy called second");
editor.commit();
Log.d("on destroy called", "gps state on destroy called third");
stopRouteTracking();
Log.d("on destroy called", "gps state on destroy called fourth");
}