Skip to content

Instantly share code, notes, and snippets.

@k0siara
Last active May 1, 2021 20:12
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 k0siara/759010659167fc2b78438e68a2c68319 to your computer and use it in GitHub Desktop.
Save k0siara/759010659167fc2b78438e68a2c68319 to your computer and use it in GitHub Desktop.
private const val TAG = "ScreenshotsUtils"
fun takeScreenshot(screenShotName: String) {
Log.d(TAG, "Taking screenshot of '$screenShotName'")
val screenCapture = Screenshot.capture()
try {
screenCapture.apply {
name = screenShotName
process()
}
Log.d(TAG, "Screenshot taken")
} catch (ex: IOException) {
Log.e(TAG, "Could not take a screenshot", ex)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment