1

I'm getting the current GPS coordinates as per this tutorial. And loading my data like this.

How can I delay loading my data until the GPS coordinates are acquired? Or in another way, how can I trigger loading of my data after the coordinates are acquired?

4

1 回答 1

0

如果我是你,我会使用一个简单的 SQLite 数据库来记录坐标。在此处阅读本教程:

http://www.vogella.com/articles/AndroidSQLite/article.html

之后,在你的类中实现一个 Location Listener,创建一个 location manager 的实例。通过注册位置监听器,使用位置管理器并请求位置更新。当您实现了位置侦听器时,您将实现一些方法“未实现的方法”,例如 onLocationChanged(Location loc)。在这种方法中,您可以提供您在教程中学到的数据库代码来记录位置数据。

这实际上很简单,尽管一开始听起来可能很复杂,但我会尝试提供一些代码让您理解,我现在不在我的笔记本电脑上!

于 2013-09-02T08:55:54.617 回答