Solved

How can I save map markers in Android so they will be displayed after the app was destroyed?

Posted on 2013-02-05
3
642 Views
Last Modified: 2013-02-08
Hey guys, I have been working on an Android application where I can tap the screen and a map marker is placed where I touched. I want to store these permanently so that when the app is closed and opened again all map markers placed previously are back as they were.

I was thinking about storing the markers info in shared preferences, but I don't think shared preferences are dynamic? I am racking my brains here, but I cannot figure out how this can be done.

I also looked into SQL lite and thought about doing it that way but its looks even trickier. The problem being that a user can add many markers so the storage would have to grow with the marker info growing.

Can any of you Android pros please help me out?


Thank you!!
0
Comment
Question by:deucalion0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Rartemass earned 500 total points
ID: 38858058
I have not coded for Android so don't know if this is the optimal method, however you may be able to treat this as a simple text file.

All you are really wanting to do (from what I can tell anyway) is effectively save co-ordinates on a map. The method of selecting the co-ordinates is secondary to the storage. It may be possible to simply save a text file to the SD card with an array of map co-ordinates. This can be easily updated and modified.
Example:
Marker number          Co-ordinates
1                                   X-Y-Z
2                                   A-B-C
3                                   H-J-K

If that is saved to the device and the app reads it at startup, the markers can be loaded. Then if the user removes or moves a marker, the array changes to reflect that.

Not sure if that helps but from what you have mentioned this is the thinking process I would be starting down.
If this doesn't work hopefully other experts with Android programming experience will comment. All the best.
0
 

Author Comment

by:deucalion0
ID: 38863904
Hi Rartemss, thanks for your input!! I managed to figure this out, i just stored map markers in an SQL lite database it was a few days solid work and it was difficult but I got there! I did consider something similar to what you suggested but it was easier to store in a database.

Thank you!!!
0
 
LVL 18

Expert Comment

by:Rartemass
ID: 38866509
No worries. Glad you got it sorted.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your app took Google’s lash recently, here are the 5 most likely reasons.
Here, we have shared an easy step by step tutorial on how to download instagram images and videos on PC, Android Mobile and iOS mobile.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question