Skip to content

Instantly share code, notes, and snippets.

@DomiR
Created May 11, 2017 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DomiR/dec9caf075ab030783b0a7d7553f6e99 to your computer and use it in GitHub Desktop.
Save DomiR/dec9caf075ab030783b0a7d7553f6e99 to your computer and use it in GitHub Desktop.
Save android canvas
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