简体   繁体   中英

Different map markers for every button

I would like to create a main intent(activity) in which someone can choose a track to follow. When a person clicks a button for a certain track, another intent will appear showing the markers along that track on a google map. There will be a "back" button which will bring you to the previous activity.

My question is... can I use a single map and, depending on the button that is clicked, to add specific markers to the map(and erase the previous ones) or highlight that track? How can I transfer a value from one intent to another?(I thought that all the buttons can start the same intent and depending on the value a specific track will be shown).

Any other ideas are welcomed :)

yes you can achieve this using single map.

just call clear() on google map object.

and secondly, on button click pass data using intent.putExtra(string,string)

method and read data by parsing bundle object in map activity and accordingly add markers to your google map.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM