Making a pluggable Android messaging app
I'm making a messaging app and I want to be able to extend it by using plugins.
The plugin
might, for example, replace :) with a smiley image.
I've written some test code which uses intent filters to find the plugins
, but I can't find a way to create an instance of the that plugin class
.
Is it possible to do this, and if not, what would be the best approach/best alternative to this?
开发者_如何学JAVAThanks.
Because applications in android each run in their own VM, I don't think the classloader of your application will have access to the classes defined in the plugin. What you can do, however, is to pass the data between your main application and the plugin via Intents
. If the plugin needs data from the main application, create a ContentProvider
to make the data available.
精彩评论