Skip to content

Commit dba4725

Browse files
committed
Added one more step in bitmap checking. #42
1 parent 71a79c8 commit dba4725

File tree

1 file changed

+3
-2
lines changed
  • library/src/main/java/io/github/douglasjunior/androidSimpleTooltip

1 file changed

+3
-2
lines changed

library/src/main/java/io/github/douglasjunior/androidSimpleTooltip/OverlayView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ public class OverlayView extends View {
6666
protected void dispatchDraw(Canvas canvas) {
6767
if (invalidated || bitmap == null || bitmap.isRecycled())
6868
createWindowFrame();
69-
70-
canvas.drawBitmap(bitmap, 0, 0, null);
69+
// The bitmap is checked again because of Android memory cleanup behavior. (See #42)
70+
if (bitmap != null && !bitmap.isRecycled())
71+
canvas.drawBitmap(bitmap, 0, 0, null);
7172
}
7273

7374
private void createWindowFrame() {

0 commit comments

Comments
 (0)