'Crea un immagine dell'oggetto passato in Download (Funziona solo in Activity)
Sub CreateObj_PNG(obj As B4XView,FileName As String)
Dim xView As B4XView = obj
Dim Bitmap1 As B4XBitmap = xView.Snapshot
Dim Out As OutputStream
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = True Then
'se il file esiste lo cancello
If File.Exists(File.Combine(File.DirRootExternal,"Download"),FileName & ".png") = True Then
File.Delete(File.Combine(File.DirRootExternal,"Download"),FileName & ".png")
End If
Out = File.OpenOutput(File.Combine(File.DirRootExternal,"Download"), FileName & ".png", False)
Bitmap1.WriteToStream(Out, 100, "PNG")
Out.Close
End If
End Sub