我启动一个服务,并尝试使用requestLocationUpdates,因为存在NULLpointerException,所以使应用程序失败。Android请求位置更新失败
0
A
回答
0
原因NullPointerException异常
你没有初始化locationManger。
以这种方式初始化。
locationManager = (LocationManager) this.getSystemService(LOCATION_SERVICE);
Location myCurrentLocation = locationManager.getLastKnownLocation(getBestProvider());
+0
@ user2138559检查并接受它是否解决您的问题.. – 2013-03-06 07:41:51
1
好像你没有初始化其刚刚声明的locationManager
。
为什么你删除了代码,如果有人发布你最喜欢的,请让它接受答案。 – 2013-03-06 15:21:26