Android Map Marker-New Screen

I’m new to development, specifically Android. Through tutorials, I’ve managed to display a map with a marker for a building that displays a “toast” box with text identifying that building, when tapped (I fashioned it after the “Noo Yawk” example). I need to display a new full screen with a photo of that building and text describing it, and use the back button to return to the map. I need to do this for at least 30 buildings.

Do I need to start a new activity for each building? It would seem complicated and resource intensive. If so, where will the photo and text reside? Do I need to have a button in the layout to call the map again? Or is there a simpler way to do this? Given the number of buildings, will content management or a database be required?

Thanks in advance and forgive my ignorance. I’ve parsed so many articles and tutorials that I’m becoming confused.


Asked by: Rubie894 | Posted: 24-01-2022






Answer 1

I would just show Dialog with ImageView (photo), TextView (information) and Button (to close Dialog).

Android dialog Screen Example

I think it would be better to keep photo and info inside database and pass them into Dialog before show.

Answered by: Chester197 | Posted: 25-02-2022



Answer 2

You can display any view on top of the view. Add marker to your map and listen for onClick events on your marker. (see https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.OnMarkerClickListener) Within the onClick event you show a view on top of the map.

Do not try to use the InfoWindows of the Maps API as the InfoWindows are rendered as an image and not as a live view. Therefor async loading of your images is not possible with InfoWindows.

Answered by: Carlos721 | Posted: 25-02-2022



Similar questions





Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top