We are very familiar with the built-in Maps application on Android and I wanted to ask if it is possible to create a location overlay that is like the overlay of the Maps application?


Is it possible to create an app that takes two images and randomly animate it to achieve what the Maps application has and change the orientation of the image with respect to the location?
Thanks in advance.
You find a brief introduction to the position sensors here: http://developer.android.com/guide/topics/sensors/sensors_position.html#sensors-pos-orient
The following code snippet is based on the Compass.java sample and reacts to an orientation change by rotating an image (like the Maps compass overlay): .
First you request the compass service (SENSOR.TYPE_ORIENTATION) in your onCreate()-method:
Then you need a listener-method to save the current orientation when changed (this is done with a SensorEventListener). The sensor returns the azimuth – in layman’s terms: compass angle
And finally you draw your overlay. The example code snippet rotates the canvas, then draws a basic shape.
For the full, working code, refer to Compass.java