Question

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

Was it helpful?

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.

OTHER TIPS

  • Draw a compass, draw the wind arrow accordingly.
  • If the device knows its orientation, rotate the whole thing so that N on the compass points to actual North.

Then ask users whether they are happy with this setup, if not, why, improve, etc. But start with something dead simple, like the above.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top