开发者

Android activity that can receive custom logic from plugins at runtime

I'm trying to write an application that manipulates camera data. I would like to make this framework extensible so that others can write different manipulation logic by implementing a single method with the appropriate signature. What I'm imagining is that the user install开发者_C百科s my application plus a few other people's plugins. When my application boots, it queries around to find implementations of the manipulation logic and loads them in.

Because I want to handle camera data in realtime, passing the image data between applications with intents is probably not workable. Instead I'd like to request objects to be sent back into my activity to be set up within the camera preview listener.

Is this possible, or is there a better way?


If you are doing this for static images (capture an image, select a transform/filter, display the result) then you could do it with any one of the existing IPC mechanisms (AIDL, network streams, etc).

However for real-time responses you will not be able to have a completely new class packaged and distributed separately from your APK loaded into your APK's class loader and used: class loading restrictions don't really permit class data to be shared between APKs. I've seen people try and build their own class loading hierarchies using DexClassLoader but to my knowledge no one has been (publicly) successful at making it do something worthwhile on non-rooted hardware.

Update: here's some details on getting DexClassLoader working: http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜