drawing images on top of google map in Android - android

i want to do the following. I am having a google map that displays my position. I have created separately a compass. Now what I want is to combine them and put the compass on top of my map. I do not know where to start for it, and how I skould implement it since data of te compass are also being updated every second I move?
If you have any tutorials please give me link cause I have not been able to find any.
In my previous app I have used a class extending Overlay but this was for only putting a pin or something like this.

You may add the image as a custom control: example (it's the home-button in the example)

Related

libGDX open a map through a button

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!

Adding markers on an image

I have an image in a custom imageview, which is a layout of a building. I need to add buttons(or markers like in google maps) in few places on the image with a longclick or drag and drop a button from the top of the screen. How the button(or marker) comes doesnt matter, but the main problem is im unable to get it on top of an image. I want it just like a marker on google map, should be able to perform onclick and onlongclick operations. Should even be able to delete it. After that i need to save my image with those buttons i added in order to load it the next time my app launches, just like my saved places in google maps.
Can anyone please suggest me a best way to do it. I am new to android and I am sorry if the same question has already been asked, I would appreciate if u can give me a link to it.
Thanks in advance.

MapPolaris and showing point bubble using button maps

I'm using Polaris map library in my android app.
https://github.com/cyrilmottier/Polaris
I've Google Map with some geo points. I'm reading them from database. I've added two buttons on the map activity - "next" and "previous" to navigate between points.
mc.animateTo(geopoints.get(arrayID));
"arrayID" is the id of the next geo point and "mc" is map controller.
It works great but I want to add one more feature.
I want annotation to be visible by default while moving between points. After click on the "next" button I want to be moved to the next point on my map and it's annotation should be visible (not only after clicking on it).
Probably there is an easy way to do it.
I should probably do something with calloutView but I can't figure it out how to do that.
I made something like this. But it's not working properly.
MapCalloutView calloutView;
calloutView = new MapCalloutView(getApplicationContext());
calloutView.setDisclosureEnabled(true);
calloutView.setClickable(true); calloutView.setLeftAccessoryView(getLayoutInflater().inflate(R.layout.accessory, calloutView, false));
calloutView.show(mMapView, geopoints.get(arrayID), false);
calloutView.setData(annotations.get(arrayID));
It is showing me bubble but it creates new calloutView which is wrong I think. For example Polaris listeners are not working. I can't deselect callout etc...
My mistake! It was so easy...
I don't need to play with MapcalloutView in Polaris.
mMapView.setSelectedAnnotation(arrayID);

Ballon on Mapview and also want to get location whenever balloon position changed on Map in android

Recently I show the ubicabs taxi booking app. I found very nice functionality inside it. In this app they have google maps for showing markers, but they have used very good UI component for that. Also I found one more uniqueness is that whenever user moves or change the position of marker through touch it will fetch the current location. One thing that I know is that it is using the onTouchEvent of Overlay but how to create that marker balloon and how to get updated location on the basis of that marker.
I am attaching a preview of that marker here. Also would like to know that how can we scroll the text inside that balloon?
The best overlay open project I have found so far is this one, link. But it is nothing compared to the picture above. Would also like to know how they created this! Great Question and picture ;)

How to communicate from Android Map Overlay to MapView

I have a problem which has been driving me mad for days - I've trawled the Web but can't find the answer to what must be a simple problem.
I am writing an Android application which uses a map to display pins at specific locations. When the user taps one of the pins I'd like to display an info window with some additional details. Simple!
I have a class that extends MapActivity (and contains a MapView) and another that extends Overlay (note that I'm not using ItemizedOverlay due to the number of pins and performance was far too slow). In the Overlay class there is a hit testing routine which determines whether the user tapped on a pin or not and if so will display a simple rectangle above the pin with the details. It all works fine but does not look that great.
I want to display a nice speech-bubble callout which in time will also contain a button or two to perform additional operations. After a lot of looking around I found this blog post and it seemed to fit the bill. The post highlights the fact that the MapView that I have placed on my MapActivity is a ViewGroup so can contain additional views, i.e. one that represents my speech-bubble callout. However, while I can follow the partial source code I'm having problems wiring it up - that's where I need some help.
I've created my 9patch image and a layout to contain it and, as a test, if I put the code in the MapActivity class then I can get the callout to display. The issue is that I need to be able to determine which pin the user has tapped so that I can get the coordinates and the associated information and this is handled by the Overlay.
So, how do I wire this up so that when a user taps a pin on the Overlay the MapActivity is called to add the new 'Callout view' to the MapView in the appropriate location with the associated text?
Update:
Well I took a bit more time to look at the sample project cited in the blog post I refer to above and now have a working implimentation. I had previously dismissed this as it was using the ItemizedOverlay but the approach was sound enough. Basically I've revised my Overlay class to accept the MapView as a parameter in the constructor so now I have access to it without having to call back down to the MapActivity. It sounds simple enough but I was trying to leave the Overlay to do what it needs to do, i.e. display the markers, and not have to tinker with the parent MapView. Fact is that it works now and I can get on with the rest of the coding.
I am not sure of what exactly you are looking for. You can find a good tutorial to figure out which point as been hit during onTap and then retrieve the overlay and print out some stuff on the map.
To display the information on fix location you could put all your info components in place in your xml with visibility invisible and change it to visible if an overlay has been touched.
Hope this helps,
Stéphane

Categories

Resources