I am a newbie. I make a simple game using Canvas. I wrote almost all the code inside the onDraw() method and there is a lot of calculations there. There is an invalidate() method in the end of onDraw() in my code. That's how I call to redraw my view. How can I redraw only a part of Canvas? The main problem is that I have a lot of calculations inside the onDraw() and it slows the whole game. I tried to use bitmaps like here:
creating a bitmap - stackOverflow
but it didn't resolve the problem because creating a bitmap is too slow process. Is it a good idea to use SurfaceHolder and Callback? I tried to use it but I don't know if it is a right way to do what I want to do. Can anybody help me? How to redraw my view only partially to stop chosen elements always redrawing by new calculations (to drawing them from saved state)? I want to redraw whole view only when it is needed. It would be great if somebody post a code which would resolve this problem (it could be even two rectangles).