Android Question Catching Event After Email Intent Initiated using StartActivity()

gregchao

Member
Licensed User
Longtime User
All,
I am using the following code to create an email window in which the User needs to fill out the sender and then email himself. It works great. Is there way to catch the event after he/she has completed the email? I notice that the User has options to "send" or "cancel". I would like to catch these options.

B4X:
    Dim FileName As String = "Somename.pdf"
    'copy the shared file to the shared folder
    File.Copy(rp.GetSafeDirDefaultExternal("") & "/pdf", FileName, Provider.SharedFolder, FileName)
    Dim email As Email
    'email.To.Add("[email protected]")
    email.To.Add("")
    email.Subject = "Somename PDF"
    email.Body = "Send This email to yourself"
    email.Attachments.Add(Provider.GetFileUri(FileName))
    Dim in As Intent = email.GetIntent
    in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
    in.SetType("application/pdf")
    StartActivity(in)
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top