Search code examples
androidgraphicscompass-geolocationdirection

How to display wind direction?


I want to create some sort of graphical arrow, or possibly draw an arrow over a compass to show the user what direction the wind is coming from. This would obviously change, given the orientation of the persons handset.

My application can tell me what direction (in degrees) the wind direction is coming from. My question is, what is the best way to implement something like this?

Thanks


Solution

  • In your Exclipse create a new Android project and select "Create project from existing sample". Choose target android version and then ApiDemos. There you will find a Compass application and many other examples which can help you draw your screen.

    I guess the best would be if your wind arrow would be in 3D or simulated 3D, so that it does not matter how the user is holding his device, for he would always look at the wind arrow from an elevated virtual vintage point.

    In the same ApiDemos there is also "Sensors" demo which draws the physical orientation of the device.