Saving markers in MapView
-
14-11-2019 - |
Question
I have a mapView to set markers on it. I would like to store this points as part of an itinerary, and later when I select that itinerary been able to see the markers that previoulsy I added.
All examples I have seen work with a file in XML a file.plist with all the points that they want to parse and draw on the mapview. But not the oposite, this is create the file from the points.
I have thought of several ways of doing this:
- Creating the file.plist. It will be easier to retrive the data later, but more hassle to create.
- Storing the points in a database along with the points of the itinerary and retriving them later.
Looking forward your advice.
Best David.
Solution
I have implemented a table in a database for the itineraries. with the id of the table as foreing key of the main table Itineraries. I think is easier this way than create the XML file.plist.
The file.plist it's very helpful when you have the static points, as offers you methods to access the variables:
PlistProperties pr = PlistFactory.createReader().parse(file);
Vector<PlistProperties> places = pr.getValues();
Object concretePlaces = places.get(0);
Vector<PlistProperties> pl = (Vector<PlistProperties>) concretePlaces;
But in this case I can create the markers using the coordinates store in the database.
OverlayItem overlayitem = new OverlayItem(point, id, POIsDBHelper.getName(id));