x, final float y) { final float dx = Math.abs(x - mX); final float dy = Math.abs(y - mY); if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) { mPath.quadTo(mX, mY, (x + mX) / 2, (y + mY) / 2); mX = x; mY = y; } } private void touchUp() { mPath.lineTo(mX, mY); if (mPaint == null) { mPaint = createNewPaint(mPaintColor, mStrokeSize); } mCanvas.drawPath(mPath, mPaint); mPath.reset(); } public void setPaint(final Paint paint) { mPaint = paint; } public void clearBoard() { mPath = new Path(); mBitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888); mCanvas = new Canvas(mBitmap); mIsSigned = false; invalidate(); } private void createDir() { final File file = new File(Environment.getExternalStorageDirectory() .getAbsolutePath().concat(File.separator).concat(DIR_ROOT_NAME) .concat(File.separator).concat(DIR_SIGNATURE_NAME)); file.mkdirs(); } public boolean persistsSignatureAtCache() { final boolean canWrite = getContext().getCacheDir().canWrite(); if (canWrite) { ByteArrayOutputStream byteArrayOutputStream = null; FileOutputStream fileOutputStream = null; File file = null; String outputDir = null; try { byteArrayOutputStream = new ByteArrayOutputStream(); mBitmap.compress(Bitmap.CompressFormat.PNG, 60, byteArrayOutputStream); outputDir = getContext().getCacheDir().getAbsolutePath(); file = new File(outputDir .concat(File.separator) .concat("signature").concat(".png")); file.createNewFile(); fileOutputStream = new FileOutputStream(file); fileOutputStream.write(byteArrayOutputStream.toByteArray()); } catch (IOException e) { e.printStackTrace(); } } return canWrite; } public boolean deleteTemporarySignature() { return false; } @Deprecated public boolean persistSignatureAtSDCard() { final boolean canWrite = Environment.getExternalStorageDirectory().canWrite(); if (canWrite) { createDir(); Calendar date = null; ByteArrayOutputStream byteArrayOutputStream = null; FileOutputStream fileOutputStream = null; File file = null; try { byteArrayOutputStream = new ByteArrayOutputStream(); mBitmap.compress(Bitmap.CompressFormat.PNG, 40, byteArrayOutputStream); date = Calendar.getInstance(); file = new File(Environment .getExternalStorageDirectory() .getAbsolutePath() .concat(File.separator) .concat(DIR_ROOT_NAME) .concat(File.separator) .concat(DIR_SIGNATURE_NAME) .concat(File.separator) .concat(date.get(Calendar.DAY_OF_MONTH) + "-" + date.get(Calendar.MONTH) + "-" + date.get(Calendar.YEAR) + "-" + date.get(Calendar.HOUR_OF_DAY) + "-" + date.get(Calendar.MINUTE) + "-" + date.get(Calendar.MILLISECOND)) .concat(".png")); file.createNewFile(); fileOutputStream = new FileOutputStream(file); fileOutputStream.write(byteArrayOutputStream.toByteArray()); } catch (IOException e) { e.printStackTrace(); } } return canWrite; } public boolean temporarySignature() { return Environment.getExternalStorageDirectory().canWrite(); } public void setColor(final int mColor) { if (mPaint == null) { mPaint = createNewPaint(mPaintColor, mStrokeSize); } this.mPaintColor = mColor; mPaint.setColor(mColor); } public void setBoardColor(final int mColor) { if (mPaint == null) { mPaint = createNewPaint(mPaintColor, mStrokeSize); } this.mBoardColor = mColor; clearBoard(); } public void setStrokeSize(final float strokeSize) { if (mPaint == null) { mPaint = createNewPaint(mPaintColor, mStrokeSize); } this.mStrokeSize = strokeSize; mPaint.setStrokeWidth(strokeSize); } public void setEraseMode(boolean eraseMode) { if (mPaint == null) { mPaint = createNewPaint(mPaintColor, mStrokeSize); } if(eraseMode) { mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); } else { mPaint.setXfermode(null); mPaint.setColor(mPaintColor); } } public void setEmbossMode(final boolean embossMode) { if (mPaint == null) { mPaint = createNewPaint(mPaintColor, mStrokeSize); } if(embossMode) { if(mPaint.getMaskFilter() != mEmboss) { mPaint.setMaskFilter(mEmboss); } } else { mPaint.setMaskFilter(null); } } public Bitmap getSignature() { return mBitmap; } public void setFullName(final String name) { this.mFullName = name; } public boolean isSigned() { return mIsSigned; } public void disable() { mIsEnable = false; clearBoard(); } public void enable() { mIsEnable = true; clearBoard(); } } Note que o nosso DrawingBoard tambem nos da a possibilidade de persistir a imagem de "assinatura" do usuario em seu cartao de memoria SD ou na pasta cache do aplicativo. Para tanto, e necessario utilizar os metodos persistSignatureAtCache() ou persistSignatureAtSDCard() - lembre de colocar a permissao no AndroidManifest.xml para que o aplicativo possa escrever no SDCard. Espero que ajude, abraco.