How do I drop spots on Google Map in an Android app? - android

I'm developing an Android application where I want to pin out certain spots/addresses on a google map. I have managed to add point to a mapView using OverlayItem and a Drawable. That works great.
But I have installed an application where the pins/spots are added asynchronously, and it looks like they are dropped from the top of the screen on to the map. Looks really nice.
I think I can manage to code the async functionality using threads, but I have no idea how to implement the "falling" feature... Does anyone have a clue??

That would seem difficult, unless the map were stationary.
If the map won't be panning/zooming, you could do the "falling" via a TranslateAnimation, applied to an ImageView that floats above the map (e.g., later child in the RelativeLayout that holds the MapView). When the animation completes, you'd make the ImageView be View.GONE, and you'd add the actual marker to the ItemizedOverlay.
Here is a sample project showing how to do drag-and-drop of an OverlayItem using a similar core concept.

Related

How to get maps rendered inside of a CardView

I'm wondering how to get the map to appear inside the CardView, like in the images below, highlighted in pink.
On the left is Strava, it shows the map with the route highilghted. On the right is Google Calendar, it has a map of the location of the calender event.
I would really appriciate some pointer on where to look in the apis to achieve this.
Regards,Luke
You need to use a MapView to achieve this.
This is part of Androids Lite Mode.
Create your card, and add the MapView inside the CardView.
Then in your onCreate(), you create the actual map and set the MapView to display that map.

MapView within ExpandableListView

In my ExpandableListView I need to add Google Map on each item.
I tried with putting Map on each item but its giving me inflate exception. And its is also stated that an MapActivity can contain only one MapView.
Is there any other idea to achieve this.
For refrence you can see here.
Your comments regarding MapActivity indicate that you are using Maps V1, which is deprecated. Maps V2 does not require a MapActivity and can have multiple maps.
That being said, your proposed implementation is unlikely to work well, as putting scrollable things in scrollable things can be problematic. It also is rather unrealisitc IMHO -- whoever came up with that design has never used an actual smartphone, as there's no point in having an interactive map that small (again, IMHO).
Consider using static maps (there's a Google API for that somewhere) for inside the ExpandableListView, where a tap on the map brings up the full map, either in your app or in the standard Maps app.
I recommend to not use static map (as for example it's not possible to zoom to particular bounds with newLatLngBounds or add a circle in particular lat/lon).
I recommend to use map fragment in lite mode:
In addition, there is also a new ‘lite mode’ map option, ideal for situations where you want to provide a number of smaller maps, or a map that is so small that meaningful interaction is impractical, such as a thumbnail in a list. A lite mode map is a bitmap image of a map at a specified location and zoom level.
Map fragment can be nested in the list.

drawing images on top of google map in 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)

Giving different id to each marker "overlay" at google maps in Android

I want each marker on the map (Map View) with different id so that I can remove it or change its icon dynamically at run time.
How do we achieve that ?
Also please I want the best way to add many markers on the map without making it slow when moving it on taping over it.
Thanks in advance
How do we achieve that ?
Subclass OverlayItem and store whatever you want in it, using that instead of the ordinary OverlayItem class for your items. For example, this sample project has a CustomItem subclass of OverlayItem that, among other things, draws different icons at runtime.
Also please I want the best way to add many markers on the map without making it slow when moving it on taping over it
Don't "add many markers" to an ItemizedOverlay, to the point where it is "when moving it on taping over it". ItemizedOverlay is designed for small numbers of items.
If you need lots of items, you will most likely need to create your own Overlay, where you can have more smarts about which subset of your items will be relevant at any given time.

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 ;)

Categories

Resources