mercredi 25 mars 2015

Command Design Pattern using Looper, Handler and Message queue in android?

i'm very new to android/java programming. I would like to redesign an existing app using a loose coupling approach. I would like to create a message in one object and send the message to another object to invoke a method in this receiver object. Then the Receiver object should be able to send a reply (acknowledge) to the sender.

I've read about the command design pattern but i'm not sure how to implement this in my program. Is it possible to create a command pattern design by using a looper, handler and a message queue in android? I read that these can be used for sending commands between different threads and some parts of my app need to run in a different thread, but i'm unsure if it's also possible to use it when i just want to send a message to another object in the same thread. If this was possible i could use the same messaging approach for the whole app. Or should i just use an example implementation using an interface as shown here http://ift.tt/1GjHBUJ for example?


I would be thankful for every advice


Thank you


Aucun commentaire:

Enregistrer un commentaire