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.
Related
I'm trying to make a button that will open a map (GPS) that will show you a specific place.
I have no idea how to open a map through libGDX, if someone knows anything like that please answer me.
At first you should think a bit more about your project.
I suggest also that you split your main goal in smaller parts.
Instead of creating a button which opens a map.
Create a Button
Create a ClickListener
What kind of a map do you want do show?
Decide if it's a map file or your current position on a map.
And then you'll know what you need. And then you can google.
Good Luck!
How do I disable a new pin being dropped when a user touches the map? This seems like this should be obvious, but I can't find it anywhere! Basically map comes up with my custom pins, user touches anywhere on the screen, a dummy pin appears and mine disappear.
You might want to change the draggable(boolean) function in markerOptions, you can set the draggable to be false.
For more information about a draggable market, you can visit this documentation.
I'm dumb. I got a little copy and paste happy and had that as part of a listener.
Like many web google map. I want to have a link in the maker. Right now I can use googleMap.setInfoWindowAdapter(new InfoWindowAdapter() .... to have html string, which I can change text font and size, but after I click the link in the mark, nothing happen. Should I block the default setOnMarkerClickListener?
Thanks.
I can not upload image. please refer this link's map
http://www.canadiantire.ca/en/store-locator.html
Sorry, what you want is not possible. While you can detect a click on the whole info window, the widgets you put in the info window will not respond to touch events. That is because what is actually shown is a bitmap of what the widgets look like, not the widgets themselves.
After seeing the last screenshots of new foursquare application and their balloon like cartoon instructions, I'd like to create some of these in my application.
I found a similar question for iPhone
Small popup for instructions... How?
Here is another screenshot of foursquare app:
I'd like to know how I could achieve that with Android.
Thanks in advance for any help.
UPDATE: This is what I could get so far but adding some buttons with a custom drawn background and layering them with a FrameLayout:
But I still couldn't get the triangle effect. Maybe there is something I can do with my custom background shape?
UPDATE2
After checking your suggestions, I decided to go with Aaron C idea and added an image with an arrow on it. This is my current result:
Thank you Snailer, QuickAction API project seems very much promissing. I'll check it out when implementing more features in my app.
Now, I just need to get the right color or maybe I could just let it this way. It seems nice too.
And, so, to summarize what I did:
Got my initial xml layout inside a FrameView.
As I'm using a frameview, everything I put in here will be piled one over the other. That's how I could add things to the layout.
In that framelayout, I put 2 relativelayouts whith an image with the triangle and a button to create the two upper popups. In the bottom I put a button only.
That's it. I hope it helps somebody.
Thank you very much again for all your help!
That sounds like a neat thing to implement. There might be a built-in Android variation on AlertDialog that achieves this, but if not here is how I would go about implementing it:
Create a new Activity whose background is black with a very high (low?) alpha color value. This will allow you to see through it to the previous Activity in the stack. Then, add your alert at whatever coordinates you like using a relative layout with padding values.
You might also want to add a touch listener that exits the Activity if the user touches the balloon (or maybe anywhere in the screen).
If you want to be fancy with coordinate placement of the balloon, you can pass this information into the new Activity using the Activity's launch Intent with the putExtra() methods.
It's probably achieved through skinning a toast.
The developer documentation shows a skinned toast in "Creating a custom toast view" at http://developer.android.com/guide/topics/ui/notifiers/toasts.html
You may want to look at the QuickAction API. It acheives this by using PopupWindow, skinned, positioned, and animated.
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.