I'm having a problem getting code to run after sending an email (see code below) which illustrates the problem.
The code after the line -- StartActivity(emsg.GetIntent) -- gets ignored -- so the MsgSentCk sub does not get run. It appears that after the email is sent (user presses send) the program resumes in the Main Activity ignoring the -- MsgSentCk -- code line. Is there anyway to get program flow to include code lines after sending an email?
B4X:
Sub SendEmail
Dim msg As String
msg="ok"
email="test@test.com"
Dim emsg As Email
emsg.To.Add(email)
emsg.Subject=msg
emsg.Body=msg
StartActivity(emsg.GetIntent)
MsgSentCk
End Sub
Sub MsgSentCk
Msgbox("msg","sent")
End Sub
The code is executed however you cannot show a msgbox after calling StartActivity. Use Log instead and you will see that the code is executed immediately. This is not what you are looking for.
You need to continue the program flow in Activity_Resume.
I've modified (code in red) to continue the program flow in Resume.
OK? Or is there a better way to do this? Thanks!
B4X:
Sub Activity_Resume
If emailsentck="yes" Then MsgSentCk
End Sub
Sub SendEmail
Dim msg As String
msg="ok"
email="test@test.com"
Dim emsg As Email
emsg.To.Add(email)
emsg.Subject=msg
emsg.Body=msg
StartActivity(emsg.GetIntent)
emailsentck="yes
End Sub
Sub MsgSentCk
Msgbox("msg","sent")
emailsentck=""
End Sub
The code is executed however you cannot show a msgbox after calling StartActivity. Use Log instead and you will see that the code is executed immediately. This is not what you are looking for.
You need to continue the program flow in Activity_Resume.