Code example for AvoidXfermode

		Bitmap bmask = mask.getBitmap(),
			   blayer = layer.getBitmap();
		int W = mask.getBitmap().getWidth(),
		    H = mask.getBitmap().getHeight();
		AvoidXfermode avoidXfermode = new AvoidXfermode(color, 0, AvoidXfermode.Mode.TARGET);
        // draw the src/dst example into our offscreen bitmap 
        int sc = canvas.saveLayer(x, y, x + W-1, y + H-1, null, 
                                  //Canvas.MATRIX_SAVE_FLAG | 
                                  //Canvas.CLIP_SAVE_FLAG | 
                                  Canvas.HAS_ALPHA_LAYER_SAVE_FLAG |
                                  Canvas.FULL_COLOR_LAYER_SAVE_FLAG //|
        canvas.drawBitmap(bmask, x, y, null);
        canvas.drawRect(x, y, x+W-1, y+H-1, avoidPaint);
Connect your IDE to all the code out there  Get Codota for Java