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


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

Sub TakeScreenshot As Bitmap
   Dim jo As JavaObject
   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))
   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?



Licensed User
Longtime 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