While that is indeed a useful tool to have in reserve in one's toolbox -- generally, as in this case, it's better to set a breakpoint in the debugger, and have a look around.
Even better, in this case, would be to ALSO set a method entry breakpoint on View.invalidate(int, int, int, int) -- and maybe on View.invalidate() and View.invalidate(Rect), though I suspect those would be redundant. (I tried looking at the disassembled code, forgetting that the Android.jar in the SDK is purely stubs, but you can check the source, or just set breakpoints on all three, and if View.invalidate() and View.invalidate(Rect) are calling View.invalidate(int, int, int, int) as I expect, eliminate them to streamline your debugging. Either something is calling invalidate() for you, or something else is causing onDraw() to be called, and either way, you'l have your basic answer in seconds. Remember, normally you don't call invalidate(...) yourself -- it's called by the system when it detects that a portion of the screen needs to be redrawn -- for example, after removing a window from on top of yours, or a layout change. Throwing an exception like you suggest is particularly useful when you're not in a position to directly debug -- for example, logging rare problems, especially ones that occur in production use. It could also come in handy if stopping at a breakpoint changes the overall behavior. On Feb 3, 2:17 pm, Dan Sherman <impact...@gmail.com> wrote: > You could see whats calling it with a quick: > > try { > throw new Exception();} catch (Exception e) { > > e.printStackTrace(); > > > > } > On Wed, Feb 3, 2010 at 5:11 PM, jamesc <jame...@gmail.com> wrote: > > Perhaps you're indirectly calling invalidate() in the onDraw(), > > resulting in a redraw loop? > > > On Feb 3, 10:00 pm, Neilz <neilhorn...@googlemail.com> wrote: > > > What else can cause onDraw() to be called, if I'm not triggering it > > > with invalidate()? > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs > > cr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en