Android Question Correct way to stop / unload module

victormedranop

Well-Known Member
Licensed User
Longtime User
i'm having a lote of problem with functions in diferent modules.
how can a unload / stop module.

activity finish is not working.

regards,

Victor
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I think you are looking for
B4X:
ExitApplication
For specific services , you can also use
B4X:
StopService(yourservicename)

But you should make sure you do not have any problem with your code that might lead to memory leaks .
Activity.Finish is the recommended way .
 
Upvote 0

victormedranop

Well-Known Member
Licensed User
Longtime User
My question es because I have a client pop3 working and a pass email to play a mp4 or mp3. work first time. y I send an video works if I send and audio close de video and play the audio, but if I try to open a video again a see al variables but nothing on the monitor, if I try mp3 again same behavior.
I really don't know what is happening.


simple code from pop3_client

If subject_email.Contains("VIDEO") Then
Log("START ACTIVITY VIDEO FROM MODULE POP3")
video.myvideo = body_email
StartActivity("video")
Else If subject_email.Contains("MP3") Then
Log("START ACTIVITY AUDIO FROM MODULE POP3")
audio.myaudio = body_email
StartActivity("audio")

in the module video or audio is mostly the same
B4X:
Sub Globals
  Dim audio_player As VideoView
End Sub
Sub Activity_Create(FirstTime As Boolean)
  Log("SUB START ACTIVIY FROM AUDIO MODULE")
If FirstTime = True Then
Activity.LoadLayout("audio")
audio_player.Initialize("audio_player")
Activity.AddView(audio_player,0%x,0%y,100%x,100%y)
End If
CallSub(video,"kill_activity")
End Sub
Sub start_player (aaudio As String)
Log("START PLAYER FROM AUDIO MODULE")
myaudio = aaudio
If audio_player.IsInitialized = True Then
If audio_player.IsPlaying = True Then
audio_player.Stop
audio_player.LoadVideo("http",myaudio)
audio_player.Play
Else
audio_player.stop
audio_player.LoadVideo("http",myaudio)
audio_player.Play
End If
Else
audio_player.Initialize("audio_player")
audio_player.LoadVideo("http",myaudio)
audio_player.Play
End If
End Sub
Sub video_player_Complete
Log("PLAYER COMPLETED FROM AUDIO MODULE")
audio_player.LoadVideo("http",myaudio)
audio_player.Play
End Sub
Sub Activity_Resume
Log("SUB RESUME FROM AUDIO MODULE")
start_player(myaudio)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Log("STOPING AUDIO MODULE")
audio_player.stop
End Sub
 
Last edited by a moderator:
Upvote 0
Top