Build an extension system for my android application
I'm trying to build an extension sy开发者_开发技巧stem for my application, basically to add different protocols in it (facebook and twitter connection for example) and be able to configure them from my main application. I want it to be pretty similar to how dolphin browser extensions work. But I haven't any idea how to start it. Do anyone have any interesting links or suggestions about the conception and the technical part ? I don't know where to start.
Thanks
There are different options to do that :
- create an interface for the service you want to build, the abstraction of the expected behavior of your twitter/facebook connectors.
- provide a way to lazyly instanciate the implementation of your choice for this service.
It could be done through a factory design pattern, a bus design pattern could also do, or dependency injection with a xml config file.
Each one has its advantages and drawbacks, some are alternatives in some cases, you should definitely have a look at those design patterns.
Regards, Stéphane
精彩评论