Android LocationManager不适用于特定活动

时间:2014-06-06 13:26:02

标签: android android-activity location locationmanager

我使用this solution获取经度和纬度。它适用于我的主要活动,但不适用于我项目的其他活动。你知道为什么吗 ?这是一个使用设备相机的全屏活动......

gpsTracker.latitude; //Always 0

请向我询问更多细节,但也许你们其中一个人知道这个问题。

1 个答案:

答案 0 :(得分:0)

感谢您的评论,但解决方案是使用

void android.app.Activity.runOnUiThread(Runnable action)

GPSTracker类没有显示异常,我错过了它:

  

无法在未调用的线程内创建处理程序   Looper.prepare()