Strange graphics artifacts in an Android application

I occasionally observe strange graphic artifacts in my application, as shown below. This is screengrab from Samsung Galaxy S3. I watched it only on this phone. I launched the application on the Samsung Galaxy Tab S4 and HTC One and have never seen this problem on any of them, although admittedly I mainly use S3 for development.

I thought the problem could be some kind of concurrency conflict when drawing on Canvas (I use the basic Android rendering methods, not OpenGL or something else), since I can clearly recognize duplicate units of the other user interface elements, so I synchronized all the code that draws or interacts with Canvas, and I'm still watching how this happens.

It clears up after about 30-90 seconds, which may be due to the regular scheduled memory cleanup operation that it performs - perhaps this is a manifestation of low available memory?

If I had enough reputation, I would put quite a lot of generosity on it. Any help appreciated. Hope someone finds out this particular problem.

Strange graphics artifacts

+5
source share
1 answer

Apply hardware levels:

setLayerType(View.LAYER_TYPE_HARDWARE, null); 
+2
source

Source: https://habr.com/ru/post/1262779/


All Articles