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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Office365 Intune 6 85
Set-Top-Box hardware and Open Source! 8 198
Current date-time from Available WiFi connections 10 31
why no phone sync 11 27
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…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
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.

770 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