views:

347

answers:

1

I'm trying to create a map overlay for displaying a video stream (MJPEG) on top of a Mapview.

Currently I've a standalone activity that creates a data thread for fetching MJPEG video frames. I'm using a handler to send a frame (as a Bitmap) from the data thread to the main activity which then updates the UI.

I'm not sure how to implement "refresh" for updating my "overlayed" video stream.

EDIT: What I mean by "refresh" is - how can I update the video portion (not the mapview) of my UI whenever I get a new video frame. I plan to paint the video frame (bitmap) in the "draw method" of my implementation of the Overlay subclass. But the "draw" method is not invoked by me directly.

Thanks.

A: 

If you're simply looking to trigger a refresh, you probably just want to call invalidate or postInvalidate on the overlay, perhaps with a dirty rectangle corresponding to the overlay's current position on the map. Once invalidated, your draw method will be called.

Roman Nurik
Thank you. This worked like a charm !
Soumya Simanta