Android MapView: custom animation possible? - android

Is it possible in Android to animate between two points in a Google MapView in a predefined number of seconds?
I want to write some sort of game where an object is flying from the start point to the end point. But the Object will be centered on the screen and the map shall be moved.
Do you have any idea how to do this? :)
Best,
kiwaque

Call animateTo() on your MapController.

Related

Drawing on the MapFragment, while keeping some elements visible

I'm developing an application that has the following goal:
Using the google maps android API 2 I get my current position, and as I start walking the application starts drawing the route I take
The twist is that the map is a "blind" map. Meaning the map is hidden, only the Marker of my current position and a dotted line of my route is shown.
Keep in mind I'm a novice developing to Android, so please be specific. (Thank you)
I managed to create the map, get my current position and zoom in to it (Had no sens to see the whole planet while i want only my current position). And it's pretty accurate so far.
The thing is I don't know what should I do from this point on.
Basicly I need a white View between the Marker and the real map. Also as I advance that View should always be on, over the MapFragment/MapView. Also I wish to keep the zoom and drag functionality's of the MapFragment.
How can I achieve this?
At this point I'm opened to any solutions.
(Been browsing for a few days now the developers site, I have seen that with the ViewOverlay class I can put messages over the map, but I'm not sure what would the correct aproach be in my case...)
To hide the whole map behind the white view I would use Polygon class Polygon Even if you specify Polygon to cover the whole map Markers will be still displayed in front of it and as so user's current position marker will be visible. You also will be able to zoom and drag.
To draw line on map use Polyline class Polyline It will draw users path as a polyline. If you want to stick with dotted line you can use Circle objects to create it. Circle

Custom camera animation on Google Maps Android

Is it possible to define custom camera animation on google maps in Android? This perhaps boils down to being able to create custom CameraUpdateFactory methods that interact with the animateCamera interpolator, etc. -- or just pass a custom animation.
The simplest thing I want to do is animate the camera at constant speed through multiple points. Say I have an array of LatLng, I want to accelerate once (perhaps zoom too), move at constant speed through all of the intermediate points, and decelerate at the last point (and perhaps reset zoom). Using map.animateCamera(CameraUpdateFactory.newCameraPosition(..)) has the unfortunate effect of zooming in/out and accelerate/decelerating at each point.
This seems too simple to not be supported out-of-the-box (both array or list of LatLng and being able to extend the camera animation functionality).
Thanks
Unfortunatelly you can't have that functionality right now.
Chaining camera positions will look fine for some cases (see lines 80-100 here), but I guess not in your case.
One thing I can suggest is positng a feature request on gmaps-api-issues.

Add a layer or a background on a mapView

I have a particular need with a mapView and i can't find any good solution.
I have a Mapview with some markers displayed on it, and it works perfectly.
My need is that i want to put a kind of layer/background on the screen, in order to "mask" the map, but i always want to see the markers, and keep all the mapview functionnalities (zoom, move, etc.)
Is there any solution available to do it?
I hope you understand my need.
Many thanks in advance.
Create an overlay that mask (cover) the part of the map that you want to cover. In the onDraw() of this oevrlay just draw something that achive your mask requirements (areas, colors and opacity).
To ensure that markers are always visible, you need to add the overlay with markers after you add the overlay that mask map to the mapView.getOverlays.add().
Enjoy it.

Android Map View Issue

I am having an app which tracks the Geopoints of the user. I simply fetch these points and use them to draw the path on Map View.
My issue is, when I see the path tracked by user, the path seems to be correctly plotted but, when I have a first look over the map,it does not show me an entire zoomed out view of the map where I can see all the track path. Instead the map begins with from where I started tracking and then I need to scroll all my way to see the further tracks.
Please Help. :)
Thanks In Advance.
Use MapController.zoomToSpan(...), you can get the span from your ItemizedOverlay methods getLatSpan(int) and getLonSpan(int). zoomToSpan(...) is a best effort method and does not guarantee that all points will be visible.

How do you drop a pin on a MapView in Android?

I can locate the pin for corresponding locations in MapView. I want to animate that pin dropping down onto the map.
How to use animation for that? Any ideas?
first of all, take a look at this tutorial that explains how to create pin overlays:
http://www.androidguys.com/2008/09/09/maps-itemizedoverlay-and-you/
then note the onDraw method of the inherited overlay.
that's where you can animate the bonds in which the pin is drawn.
Check out
http://developer.android.com/guide/topics/graphics/2d-graphics.html
It will show you how to use tween animations and transormations.

Categories

Resources