3
So, this app works like this: the user inserts a journey that goes from point C (collection) to point E (delivery).
These points are shown on the map, in the form of markers, as in the figure below.
Now I need to remove the markers by clicking on X.
The general concept is like this: I will make a list containing (String ID, Marker labelDe, Marker labelPara) and each new marker adds a line to this list in the addMarker method().
Dai, the removeMarker(String ID) method will retrieve the markers relative to the ID and remove them from the map when the user deletes the journey.
My research indicated several possible approaches. Could create a class, a list, a hashmap, etc.
I would like opinions on how best to do this and if possible, code examples.
Note that the addition of markers already works and the removal of the record also. And just at this time I will call the removeMarker method().
I think the question can be summarized in: What is the best way to create a list with types String, Marker, Marker?
Why not use the registration id in the database table for the id of the Mac?
– ramaral
the ID is already the table id. I don’t want to rebuild the map with each deletion. Then, when mounting the map, the app stores a list of each pair of bookmarks and the registration ID to use later, in deletion. My question is precisely, what would be the best way to store these values: creating array, object, hashmap, etc? What do you think?
– Rene Freak
Usually what is used is a Hashmap. Use id as key and, as value, an object of a class that stores the two Marker.
– ramaral
Fair. It worked out.
– Rene Freak