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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Password Keeper for Andriod 5 63
Contacts, help Android 5 36
Group texting 7 47
iPhone v Android phone 7 28
I recently asked a question (http://www.experts-exchange.com/Programming/Smartphones/Android/Q_28684946.html) about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
Introduction This article is a continuation of Part-1 as evident from the title. Please visit this page (http://www.experts-exchange.com/articles/18706/Backing-up-personal-data-on-your-Android-device-Part-1.html) to read the earlier Part -1. If y…
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.

914 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

18 Experts available now in Live!

Get 1:1 Help Now