How to show a small clickable item on Android map - android

I'm working on maps on Android. I create at runtime overlays and, when clicked, I show a dialog that, when clicked, goes to a new activity. I don't like so much the dialog so I would like to show a smaller clickable object (like in foursquare or in photos application for iPhone). Has anyone done something similar?

you need to create custom overlays for map annotations.
here is some code from github

Related

Android : Custom Pin Marker with buttons in Google Map API 2

I am working on android tracking application.
I need to show Connected friends on MapView. Each Friends marker contains image(Person image) and two buttons(Make Call and message) .
Note : The two buttons should show after image pressed.
I try this sample http://www.nasc.fr/android/android-using-layout-as-custom-marker-on-google-map-api/. It shows only TextView.
Is there any way to add custom marker with button or any other ideas to achieve this?
Below image shows the map-view that i want to add live views.
Thanks in Advance
If I'm not wrong, you're looking for infowindowadapter. Did you try infowindowadapter ? If not please implement it .
Here is the link
Visit Here
Thanks. Let me know if it helps.
Finally i ended up with my result with the below link
Google Maps Android API v2 - Interactive InfoWindow (like in original android google maps)
Its quiet interesting to hack layouts.
Thanks,
From the Google Maps V2 documentation:
Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (e.g., after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.
Therefore, you can't add buttons to the markers. An idea could be have that buttons somewhere in your layout and show/hide them when the user selects a marker.

What kind of "floating" Android view does Foursquare use for it's Activity Feed?

On the Foursquare activity screen, a map is displayed at the top of the scrollable activity feed, and the text appears to "float" above the map. When the map is tapped it expands to fill the screen. What kind of Android views are they using here?
I think it's a FrameLayout, with the map fragment below and a listview above, being the first element of the list an empty transparent rectangle. When you click that first element an animation is triggered to hide the listview and set the map's configuration.
I'm trying to achieve a similar screen. That's the general idea, not sure yet about the details, I'll add some code later if I can.
Can't be certain, but I'm 99% sure that they are using the Google Maps api, with markers added. Check out this link for more information: https://developers.google.com/maps/documentation/android/marker

Adding buttons to map infowindow android

In the new Google Maps for Android API v2, I can very easily get custom markers and info windows to display. However, I'm trying to have multiple buttons inside of my info window, that each perform a different onClick action but the problem is, the map treats the InfoWindow as it's own button object (no matter where I click on the InfoWindow, it presses the entire thing). Does anyone know how to customize this a bit more?
Just found this in the documentation.
As mentioned in the previous section on info windows, an info window
is not a live View, rather the view is rendered as an image onto the
map. As a result, any listeners you set on the view are disregarded
and you cannot distinguish between click events on various parts of
the view. You are advised not to place interactive components — such
as buttons, checkboxes, or text inputs — within your custom info
window.
Unfortunately, that answers it. I was trying to add the same function as you.

Android Map Itemized Overlay

In the android developer's webpage there's an example on how to show an alert dialog when the user taps on an item in the map.
What I want to do is show the default bubble the maps App shows when you tap on a POI.
Is there a way to do this? Am I missing something here?
Here is a nice solution for a balloon-like popup for Google Map markers:
https://github.com/jgilfelt/android-mapviewballoons
Nope. You'll have to roll your own views with background ninepatches (or just use a decent looking default system one, like the Toast background drawable), and add a TextView (or whatever View you want) with that background to an overlay. It's a little silly that there's nothing built in for that since the "bubble with a bit of text" is a very common developer need, but it's actually really not that much work.

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.
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.
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.

Categories

Resources