Message Box does not showup

melamoud

Active Member
Licensed User
Longtime User
hi,

I'm putting a messagebox in activity_resume but I do not see it, anything I need to do?
here is my code
B4X:
Sub Activity_Resume
   Utilities.LogM(0," resume")
   If (MonitorMissedCalls.created) Then refreshUI ' if not its too early I will get wrong defaults
   Utilities.LogM(0,Activity.GetStartingIntent)
   Utilities.LogM(0,Activity.GetStartingIntent.HasExtra("Notification_Tag"))
   Utilities.LogM(0,Activity.GetStartingIntent.GetExtra("Notification_Tag"))
   Utilities.LogM(0,Activity.GetStartingIntent.ExtrasToString)
   
   If (Activity.GetStartingIntent.HasExtra("Notification_Tag")) Then ' it been run from notification, I need to put the error message
      Dim msg As String
      msg = Activity.GetStartingIntent.GetExtra("Notification_Tag")
      Utilities.LogM(0,"Running From notification fetch mail error message:" & msg)
      ToastMessageShow("Error MSG box should be shown",False)
      Msgbox("Error, please check your configuration/connection",msg) ' TODO make it a dialog      
   End If
   
End Sub

I can see the toast message and the log right before the call to the msgbox.

anyone ?
 

melamoud

Active Member
Licensed User
Longtime User
Jon Hi,

great advice, worked like a charm,
can someone ecplain why I need to do that ?
I tried building an app that does the same thing and it worked without the doEvents,
maybe its because I'm coming from notification and not from launching the app regularry but then why is that make any difference to the Ui thread ?

thanks
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
What happens in refreshUI sub? I don't see why DoEvents is required in your code...

here it is

is it because I call invalidate ?

B4X:
Sub refreshUI
   Utilities.LogM(0," refresh UI") ' cant check for created here since will be called from initFile method and it shoulld!!
   If (sendingEmail_TE.IsInitialized = False) Then Return ' too early 
   sendingEmail_TE.Text = MonitorMissedCalls.sourceEmail
   sendingPass_TE.Text = MonitorMissedCalls.password
   targetEmail_TE.Text = MonitorMissedCalls.targetEmail
   enableSerivce.Checked = MonitorMissedCalls.serviceEnabled
   cb_manyPhones.Checked = MonitorMissedCalls.myPhoneNum
   sendingEmail_TE.Invalidate
   sendingPass_TE.Invalidate
   targetEmail_TE.Invalidate
   enableSerivce.Invalidate
   cb_manyPhones.Invalidate
End Sub
 
Upvote 0
Top