yes it's called on the UI thread. There's nothing special about the invocation; in the test case I click the button (using View.performClick) that brings up the dialog, but it crashes on the show() method. Up to that point, everything checks out. It must be something specific to how Dialogs are handled in ActivityUnitTestCase.
What I don't understand is: I realize that AUTC does not actually launch the application, it pretty much just instantiates the Activity directly and then calls its onCreate method. But it does inject a Window object, and the Dialog seems to be referencing that, so what's the difference to, say, showing a Toast (although I admit I didn't try showing toasts in a unit test, maybe that crashes, too). On Feb 8, 5:57 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote: > How do you call the showing of the dialog? > Is it on the main UI thread (and not on the test-case thread)? > > On Feb 8, 11:47 am, Matthias <m.kaepp...@googlemail.com> wrote: > > > Hi, > > > we're running into an issue here where in a unit test for an activity, > > we test a dialog that's part of the activity. However, as soon as > > control flow reaches the call to Dialog.show, the test case crashes > > with an exception: > > > Test run failed: android.view.WindowManager$BadTokenException > > > the activity window seems to be valid, and clicking buttons and > > everything works fine. Are dialog interactions generally not possible > > in ActivityUnitTestCase? Why? > > > Thanks a lot, > > -Matthias > > -- 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