I have been experiencing this problem for quite some time, and even after I searched a lot of time, I did not find a reasonable solution to my problem.
The problem I'm experiencing is that SurfaceView I am using flicker. From time to time, the objects that I draw flicker, and they change their size or color.
It seems that sometimes the application skips my calls to "Paint.setColor ()", and another - "Paint.setStrokeWidth ()".
I created methods that change the paint used, and then, to try to fix this problem, return it to the default values. However, the problem persists. I also read that the problem may be due to double buffering. This is true? I use this code for DrawingThread:
PS. u may notice that I also tried to use a dirty rectangle to try to figure out if the problem can be fixed, but still nothing. [Perhaps I didn’t understand what this actually does]
class DrawingThread extends Thread { private SurfaceHolder _surfaceHolder; private CustomView _cv; private boolean _run = false; public DrawingThread(SurfaceHolder surfaceHolder, CustomView cv) { super(); _surfaceHolder = surfaceHolder; _cv = cv; } public void setRunning(boolean run) { _run = run; } public boolean isRunning() { return _run; } public SurfaceHolder getSurfaceHolder() { return _surfaceHolder; } @Override public void run() { Canvas c; while (_run) { c = null; try {
source share