[android-developers] Re: Please help me with calculating direction from point A to B

2010-09-23 Thread Per
hmm.. Have you checked the numerical values that you get (mHeading, mBearing, angleDegrees) ? Log them and check if they look reasonable (assuming that you know where north is :). Expect some deviation caused by your surroundings. Not only the Earth is magnetic... If that looks ok, I'd suggest

Re: [android-developers] Re: Please help me with calculating direction from point A to B

2010-09-23 Thread Frank Weiss
Sounds like writing some unit test cases would help. Of course, you may need to refactor the code to make it testable. The advantage would be that you will see more clearly the input parameters and the constraints. It would divide and conquer the problem. The test cases would be the theory of

[android-developers] Re: Please help me with calculating direction from point A to B

2010-09-22 Thread Per
this works for me: 1: listen to location changes. Store the most recent location. You need it below. 2: listen to orientation changes. Store the most recent heading (azimuth) in mHeading - that's the compass direction corresponding to your viewing direction when holding your phone horizontally in

Re: [android-developers] Re: Please help me with calculating direction from point A to B

2010-09-22 Thread Pedro Teixeira
I'll try this method you described. I have 1. 2. and the destinations coordinates of 3.So I guess I can use it PS: I just want this for landscape mode, I've set it on the Manifest already. On Sep 22, 2010, at 1:12 PM, Per wrote: this works for me: 1: listen to location changes. Store

Re: [android-developers] Re: Please help me with calculating direction from point A to B

2010-09-22 Thread Pedro Teixeira
Per can you explain your example a little bit further? My code seems fine but the direction of the arrow doesnt seem accurate: public void onSensorChanged(SensorEvent event) { double mLatitude = (mLocation.getLatitude()); // lat1 location manager double mLongitude =