How to capture screen and share the captured screenshot immediately with whatsApp or other apps. #134
Answered
by
ThomasGorisse
ShankarKakumani
asked this question in
Q&A
Replies: 1 comment 2 replies
-
val bitmap = Bitmap.createBitmap(
this.arSceneView.width,
this.arSceneView.height,
Bitmap.Config.ARGB_8888
)
PixelCopy.request(
this.arSceneView, bitmap, { result ->
when (result) {
PixelCopy.SUCCESS -> {
context?.createExternalFile(
environment = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Environment.DIRECTORY_SCREENSHOTS
} else {
Environment.DIRECTORY_PICTURES
}, extension = ".png"
)?.let { file ->
bitmap.compress(Bitmap.CompressFormat.PNG, 100, file.outputStream())
Intents.view(activity, file, "image/png")
}
}
else -> showToast("Screenshot failure: $result")
}
}, Handler(
HandlerThread("screenshot")
.apply { start() }.looper
)
) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ShankarKakumani
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to capture the AR screen. I want to capture a screenshot but I don't want the status bar and navigation into the screenshot. Can someone help me?
Beta Was this translation helpful? Give feedback.
All reactions