在 Android 定位应用程序中存储之前 10 个位置

发布于 2024-10-08 20:11:11 字数 142 浏览 1 评论 0原文

你好 我是 Android 新手,正在开发一个捕获用户位置的 Android 应用程序。我需要存储最后 10 个已知位置并在单击按钮时向用户显示它们。所以请帮助我如何做到这一点。

最后 10 个位置需要更新并向用户显示。我应该只显示 10 个最近的地点

Hi
I am new to android and developing a android app which captures the user's location. I need to store the last 10 known locations and display them to the user on button click. So please help me how to do this..

The last 10 locations needs to be updated and shown to the users. I should display only 10 recent locations

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

等风来 2024-10-15 20:11:11

将 10 个位置保存在数组中,然后显示数组中的所有元素怎么样?如果您想在设备上存储位置,您可以在此处阅读有关 android 中的数据存储的信息:
http://developer.android.com/guide/topics/data/data -storage.html

how about saving the 10 locations in an array and then display all the elements in the array? if you want to store the locations on the device you can read about data-storage in android here:
http://developer.android.com/guide/topics/data/data-storage.html

手长情犹 2024-10-15 20:11:11

我认为您需要开发一些 Service ,它将通过 LocationManagerrequestLocationUpdates 方法请求用户的位置。

位置数据必须保存在某个地方(即在文件或 SQLite 数据库中(请参阅 SQLiteOpenHelper、ContentProvider))并在主应用程序活动中显示时。

I think you need to develop some Service which will request user's location via LocationManager's requestLocationUpdates method.

Location data must be saved somewhere (i.e. in file or in SQLite database (see SQLiteOpenHelper, ContentProvider)) and when displayed from main application activity.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文