Skip to content

Commit 5f1411f

Browse files
committed
fix for screen flickering in Android2D
1 parent 26ec1d1 commit 5f1411f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/src/processing/a2d/PSurfaceAndroid2D.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
import android.content.Context;
2626

27+
import android.graphics.Color;
28+
import android.graphics.PixelFormat;
2729
import android.service.wallpaper.WallpaperService;
2830
import android.support.wearable.watchface.CanvasWatchFaceService;
2931
import android.view.MotionEvent;
@@ -84,6 +86,11 @@ public SurfaceViewAndroid2D(Context context, SurfaceHolder holder) {
8486
// println("done making surface view");
8587

8688
surfaceReady = false; // Will be ready when the surfaceCreated() event is called
89+
90+
// Solves screen flickering:
91+
// https://github.com/processing/processing-android/issues/570
92+
setBackgroundColor(Color.argb(0, 0, 0, 0));
93+
getHolder().setFormat(PixelFormat.TRANSPARENT);
8794
}
8895

8996
@Override

0 commit comments

Comments
 (0)