On Sun, Aug 30, 2009 at 2:48 PM, Nick_Zaillian <[email protected]> wrote:
> Okay, actually, you can disregard that last comment. > "Thou shalt not modify the UI from a background thread, for that is > the way of sin" pretty explicitly gives me my answer. I gotta say, > this is pretty inconvenient. Must be the reason that Electrum Drum > Machine (the only other Android drum sequencer I've seen) doesn't give > the user any visual indication of playback position. Do your time critical stuff in a separate thread. Post messages to the main thread when there is something interesting it has changed for it to redraw. Or if you know you will be continually drawing, have your main thread continually running a draw loop where it draws whatever the current state is in onDraw() (but you will probably pay the price of more CPU usage for this). Or if you really want to, use a surface view to have a dedicated part of the UI that another thread can redraw outside of updates (but you are going to need to be much more careful about threading and other issues if you do this). It is perfectly possible to use the framework to have a UI update while doing background audio stuff. Heck, the media player does this just fine, as do many other apps. -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

