Created
May 11, 2017 22:48
-
-
Save DomiR/dec9caf075ab030783b0a7d7553f6e99 to your computer and use it in GitHub Desktop.
Save android canvas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Bitmap saveSignature(){ | |
Bitmap bitmap = Bitmap.createBitmap(this.getWidth(), this.getHeight(), Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(bitmap); | |
this.draw(canvas); | |
File file = new File(Environment.getExternalStorageDirectory() + "/sign.png"); | |
try { | |
bitmap.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(file)); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
return bitmap; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment