tags:

views:

35

answers:

0

I'm writing an Android application that takes information from orientation sensor and gps and overlays information over a camera preview.

I can create and view the camera preview fine using a SurfaceView and I can create an overlay using a separate View to display additional data, using invalidate() to update the overlay when sensor data changes.

The problem I have is that I'm not sure how well this will work when sensor data is changing fast and the computation required to calculate the overlay information might be heavy.

Ideally I'd have 2 SurfaceViews with the overlay 1 using a thread, however this won't work because you can only have 1 SurfaceView. I tried putting the overlay code and threading into my existing camera SurfaceView but as far as I can tell the camera preview just overwrote anything that happened in the onDraw event.

Am I right in thinking I can't rely on the View invalidate technique when it might be getting called faster than it can actually run the draw function? Is there a way to do the overlay using a thread in the existing camera SurfaceView? Or is there a different, better way to achieve what I want?