java events,handlers and listeners question

前端 未结 2 764
你的背包
你的背包 2020-12-17 04:07

Edit: I was actually able to get this to work and form, in my oppinion, a good example. The accepted answer is my example and feel free to leave comments if you

2条回答
  •  囚心锁ツ
    2020-12-17 04:31

    You're very new to Java - I think you're overcomplicating this and trying to swallow too much at once.

    Forget about your grand design. Forget about UI. Forget about Android.

    Start with a toy problem and build up.

    Can you make a single Listener class that responds to an Event and a producer class to send that Event out? Can you see the action being taken? If you can't do that, you won't get far. When you have one working, move onto the next and see if you can get your design working with these simpler objects. Only when the whole thing is working should you worry about tying in the Android and UI elements.

    Start with simple POJO models and you'll get further faster.

提交回复
热议问题