开发者

How can I "poke" an android application that adheres to the Observer pattern?

I've got a small android application that implements the Observer pattern.

I want my "subject" (or the thing being observed) to change its state, such as changing its String from hello to hello world.

How can I do this via the emulator?

I need my (observing) android application to still run in the foreground so it can display whatever is being observed, but I need to find some way to alter the state of the observed object, is it possible to do this via the command line? How else can I "poke" the observed object to change its state.

One dirty-hack method I can think of is to set the observed object up in a loop, so every 10 开发者_如何学Cseconds it changes its state, but that is not good as then I won't have control over it.


Correct answer: write a test case, and have the test case "poke" the observed object.

Not-quite-as-correct answer: add stuff to your activity to "poke" the observed object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜