[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-31 Thread niko20
> > 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. > Hi, As the dev of Electrum Drum, I'll tell you the reason - I chose not to show the position mainly to save precious

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Dianne Hackborn
On Sun, Aug 30, 2009 at 2:48 PM, Nick_Zaillian 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 rea

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Mark Murphy
Nick_Zaillian wrote: > Now, Mark, I have written an > audio pattern playback implementation using a Handler that runs in my > main Activity and, while it works, it is way less smooth and reliable > than the implementation using the Timer/separate thread. That's not surprising. Depending on what

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Nick_Zaillian
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 seq

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Nick_Zaillian
Alright, I have made the appropriate changes to my SeqSwitch class so that I no longer call setBackgroundResource from my onDraw (and in fact no longer override onDraw at all). Now, Mark, I have written an audio pattern playback implementation using a Handler that runs in my main Activity and, wh

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Romain Guy
You should call setBackgroundResource() but NOT from onDraw(). Just call this method from setIlluminated() for instance. On Sun, Aug 30, 2009 at 1:06 PM, Nick_Zaillian wrote: > > Mark and Romain, > Thanks.  That was a much prompter response than I either expected or > deserved. > Romain, I am not

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Nick_Zaillian
Mark and Romain, Thanks. That was a much prompter response than I either expected or deserved. Romain, I am not sure that I totally understand what you've said. How am I to set the background in accordance with the state of isChecked and isIlluminated from within onDraw if not by calling setBack

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Romain Guy
Do not call setBacgroundResource() in onDraw()! You are loading and setting an image every time your view is drawn. You are actually creating a infinite "loop"; onDraw() -> setBacgroundResource() -> invalidate() -> onDraw() -> setBacgroundResource() -> etc. On Sun, Aug 30, 2009 at 11:47 AM, Nick

[android-developers] Re: onDraw issue? -- what's going on?!

2009-08-30 Thread Mark Murphy
> When, however, I pass it into the runnable (called > PatternPlayTask) that I give to my Timer (which then calls > SwitchController.runSwitches every 300 milliseconds as it steps > through the pattern), it stops working. Timer/TimerTask use a background thread. Thou shalt not modify the UI from