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
558 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction Everyone is using a smartphone these days. Contacts, messages, applications, documents, bookmarks, pictures, videos and other stuff which you created and are present only on your device come under the umbrella called “Personal Data”.…
A short article about problems I had with the new location API and permissions in Marshmallow
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now