Markers information stored

We wish to use the "longclick" to change the fillcolor of the markers, and try to store the information after longclick. TinyDB may be a good choice for us, we try to use TinyDB in different screen so that we could show out the information which we stored in another screen with the listview.

But the problem is "component" is not a correct datatype that can be used. We prefer to store the marker's longitude and latitude first.

Are you using design time Map Markers or run time Map Markers? Storing Marker information as you described might be easy with design time Markers but complex if you use run time Markers. You might provide some images to show what you are attempting to do.

Then store the Marker's latitude and latitude as the first item in a List under the TinyDB 'favorite' Tag with the second item being the color. You can not store the 'color' as a Color Block, store the color as its mathematical equivalent; for instance the 'red' Color is #FF0000 in hex or 255,0,0 in RGB ( see METRIC RAT AI2 - ANDROID and HTML Colour Codes ). You probably will also have to save the component name so that later that specific marker can be updated with something other than the default color. If you use code to 'remember' the color of a Marker you will need to provide code to change to your 'favorite' parameters.

Some things to be aware of:

  • it is only possible to change the colors of the default marker pins (or a CustomMarker that is a svg image).
  • changing colors of design time Markers and saving the choice is probably straight forward. Doing something similar with run time Markers will be more complex and perhaps impossible.
  • using multiple real screens adds an order of complexity. I would not go there. Consider virtual screens to keep things simple and tidy.
  • if you dare to try this with run time Markers, you have to maintain a List of the component flags.
  • latitude and longitude can be gleaned from the Marker.Latitude and Marker.Longitude Blocks for the clicked marker. How you do this depends on whether design time or run time markers are used.
  • there might be a simpler way to achieve your goal. I don't understand why you are trying to do all this? Is it a game?

Good luck.

When you do that you will need

1 Like