• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps AsyncTask & Handler Issues?

wes000000

Lurker
I have been programming for a while with C# and have some very limited experience with Java, but I m new to Android.

I am attempting to output a short audio pulse using AudioTrack (or group of pulses on the headphone jack). I was able to use AsyncTask to succesfully get a continuous output on the headphone, but I tried to use Handler and 'postDelayed' to make that output happen periodically (albeit a short gap in between).

My goal is to send out a pulse (or group of pulses) every millisecond or so if possible. If not every 10 millisecond. But because of the quick nature it has to be on a different thread so user can still interact with UI.

And an important note is that every 1 or 10 milliseconds whatever thread of class is responsible for startingaudio pulse needs to first read UI thread (or at least get passed UI info) because the audio output will depend on what the user has selected.

What is the optimal way to do this?
 
Back
Top Bottom