Created
May 1, 2021 20:27
-
-
Save k0siara/6d909bc2935a41d8e1424d59eeab333f to your computer and use it in GitHub Desktop.
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
private const val TAG = "ScreenshotsUtils" | |
fun takeScreenshot(screenShotName: String) { | |
Log.d(TAG, "Taking screenshot of '$screenShotName'") | |
val screenCapture = Screenshot.capture() | |
val processors = setOf(MyScreenCaptureProcessor()) | |
try { | |
screenCapture.apply { | |
name = screenShotName | |
process(processors) | |
} | |
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