我已经从LocationManager中删除了NmeaListener,为什么NmeaListener的onNmeaReceived()仍然被调用?

时间:2016-07-06 03:25:08

标签: android nmea

以下是我的示例代码:

    public class GeoPointMapNewActivity extends Activity implements GpsStatus.NmeaListener {
        private LocationManager mLocationManager;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.geopointmapnew_layout);
            mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
            mLocationManager.addNmeaListener(this);
        }

        @Override
        public void onNmeaReceived(long timestamp, String nmea) {
            //i have call removeNmeaListener, but this method still be call?
            mLocationManager.removeNmeaListener(this);
        }

        @Override
        protected void onResume() {
            super.onResume();
            //******
        }

        @Override
        protected void onStop() {
            super.onStop();
            //******
        }

        @Override
        protected void onDestroy() {
            super.onDestroy();
            //*******
        }
    }

0 个答案:

没有答案