Private Provider As FileProvider 'in class_globals
Provider.Initialize
If Success Then
toast.Show("File saved successfully")
wait for (CreateFileToSend) Complete (Res As Object)
Else
toast.Show("File not saved")
End If
Dim email As Email
email.To.Add("asales@spain.europe")
email.Subject = "Spain"
email.body = "Useful information promised"
email.Attachments.Add(Provider.GetFileUri("asales.txt"))
Dim Myin As Intent = email.GetIntent
Myin.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
StartActivity(Myin)
End Sub
Sub CreateFileToSend As ResumableSub
Dim b() As Byte = txtField.Text.GetBytes("UTF8")
Dim Inps As InputStream
Inps.InitializeFromBytesArray(b, 0, b.Length)
Dim out As OutputStream
out = File.OpenOutput(Provider.SharedFolder, "asales.txt", False)
File.Copy2(Inps, out)
out.Close
Return Null
End Sub