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
608 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Monitoring mobile application usage on iPhone 1 23
MITM attack on Android phones 8 121
Need a good Angular tutorial 5 84
spam sms 9 40
Often, people trade privacy and security for convenience. However in today's concrete jungle, this is an extremely foolish decision considering the vast amount of technologies being used against consumer interest. First off, I won't waste any time e…
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.
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.
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…

861 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