Android Question [solved] Take Screenshot - then save it in a dedicated dir in gallery

trepdas

Active Member
Licensed User
Hello good people,
I have this example from erel , to take a screenshot using a java object.

B4X:
Sub TakeScreenshot As Bitmap
   Dim jo As JavaObject
   jo.InitializeContext
   Dim decor As JavaObject = jo.RunMethodJO("getWindow", Null).RunMethod("getDecorView", Null)
   Dim decorChild As JavaObject = decor.RunMethod("getChildAt", Array(0))
   decorChild.RunMethod("setDrawingCacheEnabled", Array(True))
   decorChild.RunMethod("buildDrawingCache", Null)
   Dim bmp As Bitmap = decorChild.RunMethod("getDrawingCache", Array(True))
   bmp.Initialize3(bmp)
   decorChild.RunMethod("setDrawingCacheEnabled", Array(False))
   Return bmp
End Sub



How would I save it into the phone's gallery? or better, to a dedicated directory inside the gallery?

💡
 

Mahares

Expert
Licensed User
How would I save it into the phone's gallery?
Hello good person:
The code in this below link in conjunction with the code for your screenshot can allow you to save the screenshot as an image to the Gallery or a subfolder of Gallery
 
Upvote 0
Top