0

So I have a class which extends the view class, and another class which is receiving data from an external device, when new data comes in a flag is changed, this is where I call invalidate on my view. The problem is it redraws the entire canvas (setting a new background in the parent draw() method), but I want the data that was there before to stay on the canvas, and add to it when there is an update. Is there a way to leave old data (lines, bitmaps etc) on the canvas and only update parts of it (without having to redraw it all - since I want to keep the app fast and minimise memory use)?

  • Could you show us what you have tried so far? – Cleb Jul 06 '15 at 09:26
  • use `invalidate(android.graphics.Rect)` or `invalidate(int, int, int, int)` – pskink Jul 06 '15 at 09:33
  • I wasn't using regular shapes so I would have been defining a number of rectangles. After doing some reading I ended up using Surface View, which actually draws into alternating buffers, which means you have to draw everything to screen every time. Thanks. – Michael M-H Nov 11 '15 at 12:17

0 Answers0