I would like to write a app in Android where you see a pointer that always point to a certain GPS position. So when you are turning your phone or driving around the pointer will still point to the gps position.
But I have no idea how to do the calculations with the gps position and the compass sensordata.
Can anyone give me some pointers how to get started or maybe have a example of how to do this?
To achieve this you will need to know several things:
Use the android LocationManager and register for position updates. When these updates arrive you need to extract the position and bearing (could also use compass for bearing) and convert them to the map format you are using. Commonly this will be the Google maps spherical Mercator variation.
With this information you can use trigonometry to calculate the angle between you and your tagged location and use this to draw your direction arrow on a map, or with the bearing data to tell you which way to turn.