Sub BtnSave_Click
Vibrate.Vibrate (75) ' Vibrate phone for 75 ms === Phone Library
Private b As Beeper ' Audio Library
b.Initialize(50, 600) ' 50 milliseconds, 600 hz
b.Beep
Private Obj1, Obj2 As Reflector
Private bmp As Bitmap
Private c As Canvas
Private Out As OutputStream
Private args(1) As Object
Private types(1) As String
' Private InMap As Object
' Private In As InputStream
' Private BmpMap As Bitmap
' Private w As Int 'width
' Private l As Int 'length
' Private BmpMutable As Bitmap
' Private MapCanvas As Canvas
' Private DestRect As Rect
Private Out As OutputStream
' Take a screenshot.
Obj1.Target = Obj1.GetActivityBA
Obj1.Target = Obj1.GetField("vg")
bmp.InitializeMutable(Activity.Width, Activity.Height)
c.Initialize2(bmp)
Obj2.Target = c
Obj2.Target = Obj2.GetField("canvas")
args(0) = Obj2.Target
types(0) = "android.graphics.Canvas"
Obj1.RunMethod4("draw", args, types)
'Save ScreenShot as ScrnShotTemp.png
If File.Exists(File.DirDefaultExternal&"/Download/", "ScrnShotTemp.png") Then
File.Delete(File.DirDefaultExternal&"/Download/", "ScrnShotTemp.png")
End If
Out = File.OpenOutput(File.DirRootExternal&"/Download/", "ScrnShotTemp.png", False)
bmp.WriteToStream(Out, 100, "PNG")
Out.Close
'Take ScreenShot of Google map, save as map.png
MapEx.Snapshot(gmap, "gmap")
'Save as MapMutable.png
' In = File.OpenInput(File.DirRootExternal&"/Download/", "map.png") 'Map.png
' InMap = In
' BmpMap = InMap
' 'Create a mutable Bitmap with Bitmap.InitializeMutable.
' w = BmpMap.Width
' l = BmpMap.Height
' BmpMutable.InitializeMutable(w,l) ' get layout from device layout ?? or from bg ?
' 'Create a Canvas For this Bitmap.
' MapCanvas.Initialize(Activity)
' 'Draw the drawable with Canvas.DrawDrawable
' DestRect.Initialize(0,0, w, l)
' MapCanvas.DrawDrawable(BmpMapD,DestRect)
' 'Save the Bitmap To a File (Bitmap.WriteToStream)
' Out = File.OpenOutput(File.DirRootExternal, "MapMutable.png", False)
' BmpMutable.WriteToStream(Out, 100, "PNG")
' Input file name
If FileFlag = 0 Then 'FileFlag is set to 1 by InPutFileName Sub if valid file name.
InPutFileName
Return 'Ignore
End If
'Save using FileName
Out = File.OpenOutput(File.DirRootExternal&"/Download/", FileName, False)
bmp.WriteToStream(Out, 100, "PNG")
Out.Close
'Reset
FileFlag = 0
FileName = ""
DispInput.Text = ""
End Sub
Sub gmap_SnapshotReady (Bitmap1 As Bitmap)
If File.Exists(File.DirRootExternal&"/Download/", "map.png") Then File.Delete(File.DirRootExternal&"/Download/", "map.png")
Private out As OutputStream
out = File.OpenOutput(File.DirRootExternal&"/Download/", "map.png", False)
Bitmap1.WriteToStream(out, 100, "PNG")
out.Close
End Sub