Hi,
I am using Runmethod to play a ringtone:
Is it possible to check whenever the rt.RunMethod("play", Null) has finished playing?
I want to close this activity after the alarm has played completely.
Now it is playing and only the Stopmelding button will close the activity.
Best regards,
André
I am using Runmethod to play a ringtone:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim rt,jo, jo2 As JavaObject
Dim u As Uri
Dim rm As RingtoneManager
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
rt = getRingtone
Activity.LoadLayout("ringtone")
PlayRingtone
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub getRingtone As JavaObject
jo.InitializeStatic("android.media.RingtoneManager")
jo2.InitializeContext
Dim u As Uri
u.Parse(rm.GetDefault(rm.TYPE_ALARM))
'u.Parse()
Dim rt As JavaObject
rt.InitializeContext
rt = jo.RunMethodJO("getRingtone", Array(jo2, u))
Return rt
End Sub
Sub PlayRingtone
rt.RunMethod("play", Null)
End Sub
Sub StopRingtone
rt.RunMethod("stop", Null)
End Sub
Sub Stopmelding_Click
StopRingtone
Activity.Finish
End Sub
Is it possible to check whenever the rt.RunMethod("play", Null) has finished playing?
I want to close this activity after the alarm has played completely.
Now it is playing and only the Stopmelding button will close the activity.
Best regards,
André