Refreshing or reloading an Activity

choliz

Member
Licensed User
Longtime User
Greetings,

Is it possible to refresh or reload the current activity? How about the previous one?

My activity flow is as follows:

Act1 -> Act2 -Act3

In Activity 3, some updates to a remote DB ocurrs, and since Activity 3 layout varies according the remote DB data, I would like to:

Best answer: reload Activity3 as it were being called from Activity2
Good answer: reload Activity2

I have been reading about CallSubDelayed2, but I don't get it yet.

Thanks in advance
 

mc73

Well-Known Member
Licensed User
Longtime User
I think you can call the activity_create sub,
B4X:
activity_create(false)
, when you're finished with the remote update.
 
Upvote 0

choliz

Member
Licensed User
Longtime User
You pointed me to the right track!

I solved it like this:

B4X:
Sub btnEnviarInstrucciones_Click
   Dim via As String
   Dim respuesta
   Dim request As HttpRequest
   If spnMetodo.SelectedIndex = 0 Then
      via = "aire"
   Else
      via = "mar"
   End If
   respuesta = Msgbox2("¿Desea usar estas instrucciones para este paquete?","Confirmar instrucción","Si","Cancelar","",Null)
   If respuesta = DialogResponse.Positive Then
      url3 = Main.servidor & "definir_envio.php?db=" & Main.db & "&orden=" & lstNumero & "&via=" & via & "&seguro=" & txtValor.Text
      ToastMessageShow("Enviando instrucciones, espere...",False)
      HttpUtils.CallbackJobDoneSub = "Volver"
      HttpUtils.Download("Actualizar",url3)
   End If
End Sub

Sub Volver (Job As String)
   Dim s As InputStream
   If HttpUtils.IsSuccess(url3) Then
      Activity_Create(True)
   End If
End Sub

And since I need to refresh my activities on resume, every Activity_Resume looks like this:

B4X:
Sub Activity_Resume
   Activity_Create(True)
End Sub

Thanks a lot! Next step: Push Notifications
 
Upvote 0
Top