Android Question Thread does not work when implemented in a Class

Gary Milne

Active Member
Licensed User
Longtime User
I have a need to play some tones whilst the user is touching the screen. To get the UI to continue to respond whilst the tones play I need to use a separate thread.

Well, If I implement it as inline code it all works as expected. When I package it into a class the tone does not play. If I change the class to play on the same thread then it works (but then the UI suffers)

What is it about putting the thread call into a class that causes it not to work and is there something that can be done about it.

Grateful for any responses.
 

Gary Milne

Active Member
Licensed User
Longtime User
I was using the AudioTrack library from this sample (http://www.b4x.com/android/forum/threads/audiotrack.14007/) which was using the same thread as I could not alter the screen controls whilst the sound was playing.

I switched to using the sound library and that is working as a substitute. Still a good question though as to why placing the thread in a calss caused it to not work.
 
Upvote 0
Top